let scene = UIApplication.shared.connectedScenes.first
if let sd: SceneDelegate = (scene?.delegate as? SceneDelegate) {
let window = sd.window
}
这是在 Swift 中,我想将其转换为 Objective-C。我试过这个:
UIScene *scene = [[[[UIApplication sharedApplication]connectedScenes]allObjects]firstObject];
但现在没有SceneDelegate
;在 Objective-C 中有 UIKit 的UIWindowSceneDelegate
.
我也无法访问 UIScenedelegate。Scenedelegate 在 Swift 中,我正在尝试在 Objective-c 中获取窗口,但现在我无法在 swiftUI 中访问窗口。