Skip to content

Commit 118dad9

Browse files
Auto-focus notes editing view
1 parent ae29bda commit 118dad9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Movie DB/Views/Detail/Components/NotesView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,17 @@ struct NotesView: View {
4444
fileprivate struct EditView: View {
4545
@Binding var notes: String
4646
@Environment(\.colorScheme) private var colorScheme
47+
@FocusState private var isFocused: Bool
4748

4849
var body: some View {
4950
TextEditor(text: $notes)
51+
.focused($isFocused)
5052
.textInputAutocapitalization(.sentences)
5153
.padding(5)
5254
.navigationTitle(Strings.Detail.notesNavBarTitle)
55+
.onAppear {
56+
isFocused = true
57+
}
5358
}
5459
}
5560
}
@@ -70,5 +75,4 @@ struct NotesView: View {
7075
NavigationStack {
7176
NotesView.EditView(notes: .constant("This one is being edited."))
7277
}
73-
.previewDisplayName("Editing View")
7478
}

0 commit comments

Comments
 (0)