Created
July 31, 2018 12:05
-
-
Save wata/da22b2c312f95e3d06dcbf30ea80586e to your computer and use it in GitHub Desktop.
Resume from the home screen when the application becomes active
This file contains hidden or 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
| private func backHomeIfNeeded() { | |
| guard | |
| self.needsBackHome, | |
| !(UIApplication.shared.topViewController is UIAlertController) | |
| else { return } | |
| DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { | |
| Router.go(to: .home) | |
| } | |
| } | |
| // Usage | |
| func applicationWillResignActive(_ application: UIApplication) { | |
| self.backHomeIfNeeded() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment