我可以通过以下实现来访问didFinishLaunchingWithOptions,但是我需要UIWindow变量。我不知道如何获取它。我正在使用Xcode 12 beta,iOS14和SwiftUI生命周期。
import SwiftUI
@main
struct SSOKit_DemoApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
print("hello world!!!")
return true
}
}