Created
July 20, 2022 18:31
-
-
Save romyios/c2a80458dd3264027431908e486d0de9 to your computer and use it in GitHub Desktop.
This is so nice! It's always a pain in the ass to do this stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/a/72067001/1492368 | |
struct TextFieldTest: View { | |
@FocusState private var emailFocused: Bool | |
@FocusState private var passwordFocused: Bool | |
@State private var username: String = "" | |
@State private var password: String = "" | |
var body: some View { | |
TextField("User name (email address)", text: $username) | |
.focused($emailFocused) | |
.onSubmit { | |
passwordFocused = true | |
} | |
TextField("Enter Password", text: $password) | |
.focused($passwordFocused) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment