I am new to SwiftUI and I need to call a function when user enters minimum three characters in a textfield.
Like this:
After completing three or more characters I want to perform a function. Is there any way to do this in SwiftUI?
CodePudding user response:
You can use .onChange :
.onChange(of: name) { newValue in
if newValue.count >= 3 {
// Call function
}
}