“Swiftui Textfield Focus” Réponses codées

uitextfield Obtenez focus Swift 5

Swift 5
self.becomeFirstResponder()

let textField = UITextField()
textField.becomeFirstResponder()
Wicked Wolf

Swiftui Textfield Focus

struct ContentView: View {
    enum Field: Hashable {
        case name
        case fullName
    }
    @FocusState private var focusedField: Field?

    var body: some View {
        TextField("Full Name", ...)
            .focused($focusedField, equals: .name)
            .focused($focusedField, equals: .fullName)
    }
}
Frog Caller

Réponses similaires à “Swiftui Textfield Focus”

Questions similaires à “Swiftui Textfield Focus”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code