Skip to content

Instantly share code, notes, and snippets.

@moonvader
moonvader / LoginScreenRedirect.swift
Last active May 7, 2019 01:30
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