SwiftUI:我可以在 Mac Catalyst 应用程序上使用 Mac 特定的修饰符吗?

SwiftUI: Can I use Mac-specific modifiers on Mac Catalyst app?

我正在使用 SwiftUI 和 mac 催化剂在 macOS 和 iOS 上提供待办事项列表应用程序。 我想知道是否可以访问 macOS 上可用的 every 修饰符,例如焦点 onExitCommand,而无需创建新目标(例如,仅使用 Mac 催化剂)。如文档中所述,这些修饰符仅在 macOS 上可用,但它们可以在 mac Catalyst 应用程序中使用吗?如果是,我该如何使用它们?

我知道我可以通过添加 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(将 targetEnvironnment 更改为 os 并将 macCatalyst 更改为 macOS)来向我的应用程序添加触摸栏或工具栏,但是文本未显示。
像这样简单的事情将不胜感激:

#if targetEnvironnment(macCatalyst)
Text("Hello")
   .onCopyCommand(perform: doSomething())
#endif

谢谢!

不,您不能在 Catalyst 应用中使用 macOS-only 修饰符或样式。