Intercept System Events

suggest change

NotificationCenter can observe certain app-wide events. This registration is Swift 3 (NSNotification.Name.UIApplicationDidBecomeActive). ViewController.do(_:) must exist. Observing a notification is not the same as replacing the system’s handling of that event.

NotificationCenter.default.addObserver(
        self,
        selector: #selector(ViewController.do(_:)),
        name: NSNotification.Name.UIApplicationDidBecomeActive,
        object: nil)

You can register for many more events. See https://developer.apple.com/reference/foundation/nsnotification.name.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents