Last active
January 18, 2020 22:40
-
-
Save felipericieri/85c598d4c645a2e1faf3dd0f1870d108 to your computer and use it in GitHub Desktop.
Adds a Block View as Window Subview
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 blockView = BlockView() | |
blockView.tag = 123 | |
window?.addSubview(blockView) | |
} | |
func applicationWillEnterForeground(_ application: UIApplication) { | |
let blockViewTag = 123 | |
let blockView = window?.viewWithTag(blockViewTag) | |
blockView?.removeFromSuperview() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment