Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipericieri/1366f4971a8437447d2ede40e8b2b639 to your computer and use it in GitHub Desktop.
Save felipericieri/1366f4971a8437447d2ede40e8b2b639 to your computer and use it in GitHub Desktop.
Using Additional Window to hide sensitive data
@UIApplicationMain
class AppDelegate: UIApplicationDelegate {
var window: UIWindow?
private lazy var backgroundWindow: UIWindow = {
let screen = UIScreen.main
let window = UIWindow(frame: screen.bounds)
window.screen = screen
window.rootViewController = BlockViewController()
window.windowLevel = .alert
return window
}()
// MARK: - App
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Setup your app here ...
return true
}
// MARK: - Handling Application Background State
func applicationDidEnterBackground(_ application: UIApplication) {
backgroundWindow.isHidden = true
}
func applicationWillEnterForeground(_ application: UIApplication) {
backgroundWindow.isHidden = false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment