[ad_1]
Here is my codes, trying make shortcut key works, because I have TextField it doe not work, how can I solve this problem?
struct ContentView: View {
@State private var string: String = ""
var body: some View {
VStack {
TextField("enter your text here ...", text: $string)
Button("ok") {
print("The Text is:", string)
}
.keyboardShortcut(.return, modifiers: [])
}
.frame(width: 200, height: 100)
.padding()
}
}
[ad_2]