Skip to content

Instantly share code, notes, and snippets.

@andresr-dev
Created June 2, 2023 17:36
Show Gist options
  • Save andresr-dev/dd42a3525a74ca6b97aeb6b52727d1e2 to your computer and use it in GitHub Desktop.
Save andresr-dev/dd42a3525a74ca6b97aeb6b52727d1e2 to your computer and use it in GitHub Desktop.
This is how to get the UIWindowScene in iOS
extension UIApplication {
var windowScene: UIWindowScene? {
guard let scene = connectedScenes.first(where: {
$0.activationState == .foregroundActive
}) else {
return nil
}
return scene as? UIWindowScene
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment