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)
|
@Environment(\.modelContext)
|
||||||
private var 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.
|
/// The view model managing the state and logic for this view.
|
||||||
@State
|
@State
|
||||||
private var viewModel: ViewModel
|
private var viewModel: ViewModel
|
||||||
@@ -53,20 +57,33 @@ struct NewTaskView: View {
|
|||||||
text: $viewModel.title,
|
text: $viewModel.title,
|
||||||
axis: .vertical
|
axis: .vertical
|
||||||
)
|
)
|
||||||
.autocapitalization(.sentences)
|
.focused(
|
||||||
.autocorrectionDisabled(false)
|
$inputFocus,
|
||||||
.keyboardType(.asciiCapable)
|
equals: .title
|
||||||
|
)
|
||||||
|
.onNewlineFocus(
|
||||||
|
$viewModel.title,
|
||||||
|
to: .note,
|
||||||
|
on: $inputFocus
|
||||||
|
)
|
||||||
|
|
||||||
TextField(
|
TextField(
|
||||||
"view.new-task.placeholder.note",
|
"view.new-task.placeholder.note",
|
||||||
text: $viewModel.note,
|
text: $viewModel.note,
|
||||||
axis: .vertical
|
axis: .vertical
|
||||||
)
|
)
|
||||||
.autocapitalization(.sentences)
|
.focused(
|
||||||
.autocorrectionDisabled(false)
|
$inputFocus,
|
||||||
.keyboardType(.asciiCapable)
|
equals: .note
|
||||||
.lineLimit(3 ... 6)
|
)
|
||||||
|
.onEmptyNewlineResignFocus(
|
||||||
|
text: $viewModel.note,
|
||||||
|
from: $inputFocus
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
.autocapitalization(.sentences)
|
||||||
|
.autocorrectionDisabled(false)
|
||||||
|
.keyboardType(.default)
|
||||||
|
|
||||||
Section("view.new-task.section.due-date") {
|
Section("view.new-task.section.due-date") {
|
||||||
DatePicker(
|
DatePicker(
|
||||||
|
|||||||
Reference in New Issue
Block a user