From cb8cde57f49c9b2fa6d35b891033f7df97647284 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 7 Sep 2023 09:59:00 -0500 Subject: [PATCH] fixed bug Signed-off-by: Matt Bruce --- .../ViewControllers/BaseViewController.swift | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/VDSSample/ViewControllers/BaseViewController.swift b/VDSSample/ViewControllers/BaseViewController.swift index 85534ba..dbe9d2f 100644 --- a/VDSSample/ViewControllers/BaseViewController.swift +++ b/VDSSample/ViewControllers/BaseViewController.swift @@ -236,7 +236,23 @@ public class BaseViewController: UIViewController, Initable , self?.activeTextField = nil }.store(in: &subscribers) - loadCustomRotors() + + NotificationCenter.default.publisher(for: UIAccessibility.voiceOverStatusDidChangeNotification).sink { [weak self] _ in + if UIAccessibility.isVoiceOverRunning { + if let component = self?.component { + DispatchQueue.main.asyncAfter(deadline: .now() + 1) { + self?.loadCustomRotors() + UIAccessibility.post(notification: .screenChanged, argument: component) + } + } + } + }.store(in: &subscribers) + + // Initially register the custom rotor if VoiceOver is on + if UIAccessibility.isVoiceOverRunning { + loadCustomRotors() + UIAccessibility.post(notification: .screenChanged, argument: component) + } } func isViewHiddenByKeyboard(view: UIView, keyboardFrame: CGRect) -> Bool {