Recipe edit view polish

This commit is contained in:
VincentMeilinger
2024-03-05 21:42:02 +01:00
parent b5dbaad9aa
commit 11359e11d4
11 changed files with 157 additions and 137 deletions

View File

@@ -12,7 +12,7 @@ import SwiftUI
struct RecipeListSection: View {
@State var list: [String]
@Binding var list: [String]
var body: some View {
VStack(alignment: .leading) {
@@ -74,14 +74,17 @@ struct EditableListView: View {
List {
if items.isEmpty {
Text(emptyListText)
} else {
ForEach(items.indices, id: \.self) { ix in
TextField(titleKey, text: $items[ix], axis: axis)
.lineLimit(lineLimit)
.padding(5)
}
.onDelete(perform: deleteItem)
.onMove(perform: moveItem)
.scrollDismissesKeyboard(.immediately)
}
ForEach(items.indices, id: \.self) { ix in
TextField(titleKey, text: $items[ix], axis: axis)
.lineLimit(lineLimit)
}
.onDelete(perform: deleteItem)
.onMove(perform: moveItem)
}
VStack {
Spacer()
@@ -104,7 +107,7 @@ struct EditableListView: View {
Text("Done")
}
)
.environment(\.editMode, .constant(.active)) // Bind edit mode to your state variable
.environment(\.editMode, .constant(.active))
}
}