uitextfield mendapatkan fokus swift 5
Swift 5
self.becomeFirstResponder()
let textField = UITextField()
textField.becomeFirstResponder()
Wicked Wolf
Swift 5
self.becomeFirstResponder()
let textField = UITextField()
textField.becomeFirstResponder()
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)
}
}