Hi,
I am trying to focus a textbox once a button is clicked, and I am not sure how to do this?
Present TextField
@State var isHidden: Bool = true
...
if !isHidden {
withAnimation{
TextField("Add Note...", text: $textValue)
.padding(.top, 10.0)
}
.transition(.move(edge: .trailing))
.textFieldStyle(RoundedBorderTextFieldStyle())
}
Button to show Text Field
if (buttonCount == 0){
isHidden = false
buttonCount += 1
}
At the moment everything works fine but when I click the button to show the textfield its not auto-selected by default.
MacOS Version: > 11.0