Reputation: 5600
I started a sample iOS app in order to explore SwiftUI; at some point I thought enabling Mac support would be a fun thing try, and surprisingly, I have good result with little to no additional code.
Testing the app on the Mac, I notice the app quits once I close its window, which is not the way most apps work.
Trying to use applicationShouldHandleReopen
is not an option since NSApplicationDelegate
is not possible for Catalyst, I was not able to find a counterpart either in UIApplicationDelegate
or UISceneDelegate
, and I was not able to find anything on this topic on Apple's documentation.
What's the proper way to implement the traditional Mac app behavior(†) on a Catalyst app?
(†) Traditional mac app behavior: When the app window is closed, the app icon remains in the doc and if you click it the apps window reappears again
Upvotes: 2
Views: 1791
Reputation: 69
To summarize, do one of the followings
Info.plist
Another answer in the same question recommends setting NSSupportsAutomaticTermination
to NO
. This also works, but I am not sure if messing with NSSupportsAutomaticTermination
brings you "surprises".
Upvotes: 2