Skip to content

Instantly share code, notes, and snippets.

@mlavergn
Created September 2, 2020 19:01
Show Gist options
  • Save mlavergn/62007521d572ecd7794065fead3b9200 to your computer and use it in GitHub Desktop.
Save mlavergn/62007521d572ecd7794065fead3b9200 to your computer and use it in GitHub Desktop.
iOS13 Deprecations
// keyWindow
- UIApplication.shared.keyWindow
+ UIApplication.shared.windows.first { $0.isKeyWindow }
// alt via Scenes
- UIApplication.shared.keyWindow
+ UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.flatMap { $0.windows }.first { $0.isKeyWindow }
// statusBarFrame
- UIApplication.shared.statusBarFrame
+ UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first { $0.windows.contains { $0.isKeyWindow } }?.statusBarManager?.statusBarFrame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment