Tutorial by Examples

A common approach to get the top most UIViewController is to get the RootViewController of your active UIWindow. I wrote an extension for this: extension UIApplication { func topViewController(_ base: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController ...
Using the NotificationCenter of iOS, which can be very powerful, you are able to intercept certain app-wide events: NotificationCenter.default.addObserver( self, selector: #selector(ViewController.do(_:)), name: NSNotification.Name.UIApplicationDidBecomeActive, o...

Page 1 of 1