1

I have a screen in my app that contains a TextField.

I want the keyboard for the TextField to be displayed on default (i.e. as soon as the user navigates to the view, the keyboard should already be up).

How is this accomplished?

ajf1000
  • 409
  • 5
  • 13
  • It’s not possible at the moment in SwiftUI. You can interface with UIKit to achieve this. https://stackoverflow.com/questions/56507839/swiftui-how-to-make-textfield-become-first-responder – Ishmeet Apr 22 '20 at 06:41
  • @Ishmeet that helps a lot, thanks – ajf1000 Apr 23 '20 at 02:11

1 Answers1

0

You have to just make an outlet from textfield and follow the following code.

https://stackoverflow.com/a/49815898/5086658

Abhishek Biswas
  • 1,125
  • 1
  • 13
  • 19
  • Outlets are used with storyboards. The question is for SwiftUI and although you can use storyboards with SwiftUI, the question doesn’t mention them. – Magnas Apr 22 '20 at 03:53