Skip to content

Instantly share code, notes, and snippets.

@moonvader
Last active May 7, 2019 01:30
Show Gist options
  • Save moonvader/585bc83bc147408347aa0641cffdb35d to your computer and use it in GitHub Desktop.
Save moonvader/585bc83bc147408347aa0641cffdb35d to your computer and use it in GitHub Desktop.
iOS Login Screen Redirect in Swift
func showLoginScreen() {
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
let frame = UIScreen.main.bounds
let window = UIWindow(frame: frame)
window.rootViewController = LoginViewController.instanceFromStoryboard(delegate: self)
window.makeKeyAndVisible()
window.alpha = 0
UIView.animate(withDuration: 0.25) {
window.alpha = 1
}
self.window = window
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment