Skip to content

'keyWindow' was deprecated in iOS 13.0 #6

Description

@2sem

Issue

'keyWindow' was deprecated in iOS 13.0 : Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes

Where

GADManager.swift:455, 459

Solution

  1. Add extension for UIApplication
extension UIApplication {
    var keyRootViewController: UIViewController? {
        guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else { return nil }
        
        return windowScene.windows.first(where: { $0.isKeyWindow })?.rootViewController
    }
}
  1. Replace keyWindow... with keyRootViewController

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions