SwiftUI 将AppDelegate添加到SwiftUI应用
作者:
fordG | 来源:发表于
2020-12-15 11:11 被阅读0次import SwiftUI
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
print("Your code here")
return true
}
}
@main
struct iDineApp: App {
//将AppDelegate添加到SwiftUI应用
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
AppView()
}
}
}
本文标题:SwiftUI 将AppDelegate添加到SwiftUI应用
本文链接:https://www.haomeiwen.com/subject/fdaigktx.html
网友评论