Created
September 28, 2018 10:26
-
-
Save elpsk/ffd5b9490c4e66186423275a8944d5c9 to your computer and use it in GitHub Desktop.
Swift - Voice over detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// VoiceOverVC.swift | |
// Created by Pasca Alberto, IT on 10/08/18. | |
// Copyright © 2018 albertopasca.it. All rights reserved. | |
// | |
import UIKit | |
class VoiceOverVC: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
voiceOverStatus() | |
} | |
private func voiceOverStatus() { | |
NotificationCenter.default.addObserver(self, selector: #selector(voiceOverStateChanged), name: Notification.Name.UIAccessibilityVoiceOverStatusDidChange, object: nil) | |
} | |
@objc func voiceOverStateChanged(_ notification: Notification) { | |
print( "VOICE OVER enabled: \(UIAccessibilityIsVoiceOverRunning())" ) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment