Updated the NewTaskView view in the app target to use the new view modifiers.
This commit is contained in:
@@ -22,6 +22,10 @@ struct NewTaskView: View {
|
||||
@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
|
||||
private var viewModel: ViewModel
|
||||
@@ -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
|
||||
)
|
||||
.focused(
|
||||
$inputFocus,
|
||||
equals: .note
|
||||
)
|
||||
.onEmptyNewlineResignFocus(
|
||||
text: $viewModel.note,
|
||||
from: $inputFocus
|
||||
)
|
||||
}
|
||||
.autocapitalization(.sentences)
|
||||
.autocorrectionDisabled(false)
|
||||
.keyboardType(.asciiCapable)
|
||||
.lineLimit(3 ... 6)
|
||||
}
|
||||
.keyboardType(.default)
|
||||
|
||||
Section("view.new-task.section.due-date") {
|
||||
DatePicker(
|
||||
|
||||
Reference in New Issue
Block a user