Post

Replies

Boosts

Views

Activity

Reply to onOpenURL not called for single-window Mac OS application
Eventually solved it using a custom app delegate: final class AppDelegate: NSObject, NSApplicationDelegate { var openUrlCallback: ((_ url: URL) -> Void)? func application(_ application: NSApplication, open urls: [URL]) { for url in urls { openUrlCallback?(url) } } } struct MyApp: App { @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate var body: some Scene { Window("My App", id: "my_app") { Text("Hi").onAppear { appDelegate.openUrlCallback = { url in print("Open URL", url) } } } } }
May ’24