Skip to content

Instantly share code, notes, and snippets.

@elpsk
Created September 28, 2018 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elpsk/ffd5b9490c4e66186423275a8944d5c9 to your computer and use it in GitHub Desktop.
Save elpsk/ffd5b9490c4e66186423275a8944d5c9 to your computer and use it in GitHub Desktop.
Swift - Voice over detection
//
// 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