Last active
January 18, 2020 22:41
-
-
Save felipericieri/5d8e1eb97b9fdca6f3178f2ef846d456 to your computer and use it in GitHub Desktop.
Change Window Root View Controller
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
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
// MARK: - Handling Application Background State | |
func applicationDidEnterBackground(_ application: UIApplication) { | |
let blockViewController = BlockViewController() | |
self.lastViewController = window?.rootViewController | |
window?.rootViewController = blockViewController | |
} | |
func applicationWillEnterForeground(_ application: UIApplication) { | |
window?.rootViewController = lastViewController | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment