I need to code differently when Voice Over is on.
I found this:
Notification coding is unknown to me. I need the Notification to change my variable "accessibilityIsOn: Bool" as Voice Over changes. I've been reading google and learned that I do not need Notifications; What I need is the way to detect if the user is using Voice Over.
More reading revels this:
So I will read how to use it.
I found this:
Code Block UIAccessibility.voiceOverStatusDidChangeNotification
Notification coding is unknown to me. I need the Notification to change my variable "accessibilityIsOn: Bool" as Voice Over changes. I've been reading google and learned that I do not need Notifications; What I need is the way to detect if the user is using Voice Over.
More reading revels this:
Code Block isVoiceOverRunning
So I will read how to use it.
Generally, SwiftUI is designed to work well with Combine.
You can try something like this:
You can try something like this:
Code Block struct ContentView: View { @State var accessibilityIsOn: Bool = false var body: some View { Text("This can be some complex View") .padding() .onReceive(NotificationCenter.default.publisher(for: UIAccessibility.voiceOverStatusDidChangeNotification)) { _ in self.accessibilityIsOn = UIAccessibility.isVoiceOverRunning } } }