其他分享
首页 > 其他分享> > macOS SwiftUI 如何使用AppDelegate

macOS SwiftUI 如何使用AppDelegate

作者:互联网

macOS SwiftUI 如何使用AppDelegate

实战代码

import SwiftUI
class AppDelegate:NSObject,NSApplicationDelegate{
    func applicationDidFinishLaunching(_ aNotification: Notification) {
        print("finished")
    }
}

@main
struct macos_camera_demoApp: App {
    @NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

标签:body,macOS,ContentView,AppDelegate,SwiftUI,var
来源: https://blog.csdn.net/iCloudEnd/article/details/112424337