How to tell Smart Invert in iOS 11 not to invert my app colors and detect if it is enabled? How to tell Smart Invert in iOS 11 not to invert my app colors and detect if it is enabled? ios ios

How to tell Smart Invert in iOS 11 not to invert my app colors and detect if it is enabled?


Ignore smart invert for all UIImageViews. Set in app delegate

if #available(iOS 11.0, *) {   UIImageView.appearance().accessibilityIgnoresInvertColors = true}


Swift 4.2

To check if it smart invert is currently enabled you can use UIAccessibility.isInvertColorsEnabled.You can also get a notification when it changes by observing UIAccessibility.invertColorsStatusDidChangeNotification:

NotificationCenter.default.addObserver(forName: UIAccessibility.invertColorsStatusDidChangeNotification,                                       object: nil,                                       queue: OperationQueue.main) {                                        [weak self] _ in    if UIAccessibility.isInvertColorsEnabled {    // smart invert is enabled  } else {     }}


matomo