Skip to content

Instantly share code, notes, and snippets.

@wata
Created July 31, 2018 12:05
Show Gist options
  • Select an option

  • Save wata/da22b2c312f95e3d06dcbf30ea80586e to your computer and use it in GitHub Desktop.

Select an option

Save wata/da22b2c312f95e3d06dcbf30ea80586e to your computer and use it in GitHub Desktop.
Resume from the home screen when the application becomes active
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