Here is the code copy and pasted as is: p.s. it is linked with Boost lib (C++)
Code Block | @main |
| class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate { |
|
| var window: NSWindow! |
|
| // Xcode warning here: Instance method 'applicationDidFinishLaunching' nearly matches optional requirement 'applicationDidFinishLaunching' of protocol 'NSApplicationDelegate' |
| // |
| func applicationDidFinishLaunching(_ aNotification: Notification) { |
|
| // Create the SwiftUI view that provides the window contents. |
|
| print("FIX applicationDidFinishLaunching") |
|
| let contentView = ContentView() |
|
| // Create the window and set the content view. |
|
| window = NSWindow( |
| contentRect: NSRect(x: 0, y: 0, width: 480, height: 300), |
| styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView], |
| backing: .buffered, defer: false) |
| window.isReleasedWhenClosed = false |
| window.center() |
| window.setFrameAutosaveName("Main Window") |
| window.contentView = NSHostingView(rootView: contentView) |
| window.makeKeyAndOrderFront(nil) |
| } |
|
| // Xcode warning here: Instance method 'applicationWillTerminate' nearly matches optional requirement 'applicationDidFinishLaunching' of protocol 'NSApplicationDelegate' |
| // |
| func applicationWillTerminate(_ aNotification: Notification) { |
| // Insert code here to tear down your application |
| } |
|
| } |