How get current keywindow equivalent for multi window SceneDelegate Xcode 11?

后端 未结 6 1093
北海茫月
北海茫月 2020-12-31 22:33

I\'m converting my iOS13 app for iPadOS to SceneDelegate (multi window).

How can I get the current UIWindow from the current SceneDelegate?

I know that a can

6条回答
  •  春和景丽
    2020-12-31 23:19

    You could try:

        if let window = UIApplication.shared.windows.first(where: { (window) -> Bool in window.isKeyWindow}) {
        //your code
        }
    

    Hope this helps!

提交回复
热议问题