Skip to content

Instantly share code, notes, and snippets.

@felipericieri
Last active January 18, 2020 22:40
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/85c598d4c645a2e1faf3dd0f1870d108 to your computer and use it in GitHub Desktop.
Save felipericieri/85c598d4c645a2e1faf3dd0f1870d108 to your computer and use it in GitHub Desktop.
Adds a Block View as Window Subview
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