Is there a way to capture the value in the TextField without hitting the return key? I have a TextField that I would like to capture the value (years) without hitting the return key. onEditingChanged is triggered only when the field has focus or left focus onComit is triggered only when the return key is hit.
The scenario I am looking at is when I enter "5", for example, in the field and hit "Done", I would like to capture the new value not the existing value.
TextField("Number of Years...", value: $years, formatter: integerFormatter, onEditingChanged: { _ in
print("OnEditingChanged: \(years)")
},
onCommit: {
print("\(years)")
})