Updated the NewTaskView view in the app target to use the new view modifiers.

This commit is contained in:
2026-02-12 02:17:15 +01:00
parent 81859cf841
commit cf90554001
+24 -7
View File
@@ -21,6 +21,10 @@ struct NewTaskView: View {
/// SwiftData model context for saving todo tasks.
@Environment(\.modelContext)
private var modelContext
/// Tracks which text field currently has keyboard focus.
@FocusState
private var inputFocus: InputFieldFocus?
/// The view model managing the state and logic for this view.
@State
@@ -53,20 +57,33 @@ struct NewTaskView: View {
text: $viewModel.title,
axis: .vertical
)
.autocapitalization(.sentences)
.autocorrectionDisabled(false)
.keyboardType(.asciiCapable)
.focused(
$inputFocus,
equals: .title
)
.onNewlineFocus(
$viewModel.title,
to: .note,
on: $inputFocus
)
TextField(
"view.new-task.placeholder.note",
text: $viewModel.note,
axis: .vertical
)
.autocapitalization(.sentences)
.autocorrectionDisabled(false)
.keyboardType(.asciiCapable)
.lineLimit(3 ... 6)
.focused(
$inputFocus,
equals: .note
)
.onEmptyNewlineResignFocus(
text: $viewModel.note,
from: $inputFocus
)
}
.autocapitalization(.sentences)
.autocorrectionDisabled(false)
.keyboardType(.default)
Section("view.new-task.section.due-date") {
DatePicker(