2

I would like my macOS app written in SwiftUI to handle a URL. And it just works.

@main
struct TheApp: App {
    var body: some Scene {
        WindowGroup {
            Text("Hello world")
        }
        .handlesExternalEvents(matching: ["the-url-schema"])
    }
}

However, it always shows the window once the URL is open. I could close it immediately, but then it appears for a second anyway. I need the window to stay closed until I really need it.

  • Have you tried with `allowing` argument as described [here](https://stackoverflow.com/a/66664474/7801492). – Urska Krivc Jan 25 '23 at 08:33
  • The problem is that the app should not show any window at all sometimes. After calling the URL, the (newly opened) app would decide if show any UI or not – Marcin Krzywonos Jan 25 '23 at 08:52

0 Answers0