macOS SwiftUI 如何使用AppDelegate
程序员文章站
2024-03-24 13:21:34
...
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()
}
}
}
上一篇: 仿写《今日头条》的tag选择页面
下一篇: iOS文本绘制TextKit框架