File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import SwiftUI
22
33struct SignInCredentialsView : View {
4+ private enum FocusedField {
5+ case username, password
6+ }
7+
48 @EnvironmentObject var appState : AppState
59 @State private var username : String = " "
610 @State private var password : String = " "
11+ @FocusState private var focusedField : FocusedField ?
712
813 var body : some View {
914 VStack ( alignment: . leading) {
@@ -16,11 +21,13 @@ struct SignInCredentialsView: View {
1621 TextField ( text: $username) {
1722 Text ( verbatim: " example@icloud.com " )
1823 }
24+ . focused ( $focusedField, equals: . username)
1925 }
2026 HStack {
2127 Text ( " Password " )
2228 . frame ( minWidth: 100 , alignment: . trailing)
2329 SecureField ( " Required " , text: $password)
30+ . focused ( $focusedField, equals: . password)
2431 }
2532 if appState. authError != nil {
2633 HStack {
You can’t perform that action at this time.
0 commit comments