iosswiftuitextfieldbecomefirstresponder

Setting text field as first responder on app launch in Swift iOS


I have a simple app with a couple text entry fields. When I launch the app, nothing happens until I tap a field or use a control. How do I set the focus to be on the first text field and open the keyboard when the app launches, saving the user a tap? (new to swift - is this setting the first responder? - not sure how that works)


Solution

  • Agreed with @Sh_Khan's answer,

    Just verify one more thing to disable the hardware keyboard. You'll need to toggle your keyboard through ⌘K or through below steps,