//
// Search_MenuApp.swift
// Search Menu
//
// Created by Andrew Dunbar on 30/8/2023.
//
import SwiftUI
@main
struct MenuTestApp: App {
@State private var textfieldValue: String = "the text field value"
var body: some Scene {
WindowGroup {
ContentView()
}
.commands {
CommandMenu("My Menu") {
Button("Submenu Item 1") { print("You pressed sub menu 1.") }
.keyboardShortcut("S")
TextField("Sub Menu Item 2", text: $textfieldValue) { print("You committed the string.") }
Button("Sub Menu Item 3") { print("You pressed sub menu 2.") }
}
}
}
}
//
// Search_MenuApp.swift
// Search Menu
//
// Created by Andrew Dunbar on 30/8/2023.
//
import SwiftUI
@main
struct MenuTestApp: App {
@State private var textfieldValue: String = "the text field value"
var body: some Scene {
WindowGroup {
ContentView()
}
.commands {
CommandMenu("My Menu") {
Button("Submenu Item 1") { print("You pressed sub menu 1.") }
.keyboardShortcut("S")
TextField("Sub Menu Item 2", text: $textfieldValue) { print("You committed the string.") }
Button("Sub Menu Item 3") { print("You pressed sub menu 2.") }
}
}
}
}