.onTapGesture {
// do something
}
Doesn't work because TextFields can be tapped without beginning editing mode.
CodePudding user response:
The answer is to initialize TextField with the onEditingChanged parameter.
We can then execute a closure conditionally depending upon whether the text field was edited or changes were committed:
TextField("", text: $email, onEditingChanged: { changed in
if changed {
// User began editing the text field
}
else {
// User tapped the return key
}
})
CodePudding user response:
Have you tried with onEditingChanged
.onEditingChanged {
//do something cool
}
