SwiftUI on TextField pre-fill (from auto suggestion) focus next TextField

Viewed 17

I have a form with first and last name. When first name text field becomes first responder on top of the keyboard gives auto suggestion for first name.

I want to detect when user did pick suggested first name from the keyboard and activate last name text field.

What is the way to detect these type of activity?

enum Field {
    case firstName, lastName
}

@FocusState private var focusedField: Field?
TextField(...)
   .focused($focusedField, equals: Field.firstName)
   // TODO: Catch event, that suggested text was entered

TextField(...)
   .focused($focusedField, equals: Field.lastName)
0 Answers
Related