I have a TextField in a view that looks something like this:
@FocusState private var keyboardFocused: Bool
VStack {
TextField("Name your item...", text: $itemName)
.focused($keyboardFocused)
...
}
Now, this is all embedded in a view that loads when a button is pressed, like this:
Button(action: someAction, label: { ... })
.fullScreenCover(isPresented: $viewIsPresented) {
ViewWithTextField(...)
}
I want to make it so that when this view loads, the TextField is automatically activated/(focused?) and the keyboard pops up. How can I accomplish this?