Hi,
Within my app, I am building a menu and don't want it to close with every click. When you click start, I want the menu to remain open etc. I have searched the documentation and this seems like exactly what I want. I am still very new to Swift so potentially making a silly mistake.
I have decided to play with just example code from the documentation and use within my ContextView file.
import SwiftUI
struct ContentView: View {
@State private var count = 0
var body: some View {
VStack {
Menu("Font size") {
Button(action: {count += 1}) {
Label("Increase", systemImage: "plus.magnifyingglass")
}
.menuActionDismissBehavior(.disabled)
Button("Reset", action: {count = 0})
Button(action: {count -= 1}) {
Label("Decrease", systemImage: "minus.magnifyingglass")
}
.menuActionDismissBehavior(.disabled)
}
}
.padding()
}
}
#Preview {
ContentView()
}
Xcode keeps saying "disabled" is unavailable in MacOS. I am a bit confused as the documentation says it can work from MacOS 13.3+. I am using the latest OS, latest Xcode etc.
Very confused. Any help would be greatly appreciated.
Thanks in advance