Could I just ask some questions about Commands?
1)Is it possible to enable/disable New Window
menu item?
2)Is it possible to create a CommandMenu
between File and Edit?
thanks
Could I just ask some questions about Commands?
1)Is it possible to enable/disable New Window
menu item?
2)Is it possible to create a CommandMenu
between File and Edit?
thanks
@Sarah any suggestions?
Hi,
@State private var disableNew = false
// ...
CommandGroup(replacing: .newItem) {
Button("New Window") {
// open a new window manually
NSApp.mainWindow?.windowController?.newWindowForTab(nil)
}
.disabled(disableNew)
}
CommandMenu
, it will always be placed between the View and Window menus.Sarah
@sarah
I got it.
I need to switch to AppKit to control some UI components.
So, can I say that the SwiftUI is not ready for macOS. right?
thanks for help.
I would say that SwiftUI is ready for macOS but just like in iOS, SwiftUI does not yet have equivalents for every UI element and interaction.
I think it will be a long time before we can do without AppKit/UIKit completely, but starting with SwiftUI and adding these still makes for an easier development process.