我可以通过以下实现访问didFinishLaunchingWithOptions 。但是,我需要UIWindow变量。我不知道如何得到它。我正在使用 Xcode 12 测试版。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
}
}