|
I'm creating menu bar app in SwiftUI and I want to add settings. Currently I have two problems:
Also, for the second point, I've tried setting Application is agent in Info.plist and changing NSApp.setActivationPolicy() depending if Settings window is open. However, I couldn't figure how to listen to the Settings window open/closed state.
|
|
Have you found a solution to this? I'm in exactly the same situation, and am just starting to investigate how to solve it. |
|
Answering my own question, I think I've got a working version.
However this only seems to work consistently when closing and re-opening the window when I also have the AppDelegate assigned from your example and I apply I've found a number of other suggestions on various forums, including extending |
|
|
|
...nope. Still all sorts of weirdness with the above suggestions.
Something that seems to almost work consistently is to add this library: https://github.com/orchetect/SettingsAccess
This also keeps the
For making the app disappear from the dock upon closing the last window, using the AppDelegate as follows seems to do the trick. Unclear as of yet if there are any side effects:
|
SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.