I'm making a todo-list app available on macOS and iOS using SwiftUI and mac catalyst.
I wondered if it is possible to access every modifier available on macOS such as focus, onExitCommand, without creating a new target (e.g., only using Mac Catalyst). These modifiers are, as mentioned in the documentation, only available on macOS, but can they be used in mac Catalyst apps? And if they are, how can I use them?
I know I can add a touch bar or a toolbar to my application by adding something like this to the AppDelegate, but these are specific, there's only a few that can be implemented like that. I tried to follow this answer's advice (changing targetEnvironnment
to os
and macCatalyst
to macOS
), but the Text didn't show up.
Something as simple as this would be appreciated:
#if targetEnvironnment(macCatalyst)
Text("Hello")
.onCopyCommand(perform: doSomething())
#endif
Thank you!
No, you cannot use macOS-only modifiers or styles in a Catalyst app.