Yeah, I figured something like that might be causing the issue. Here is my code for the list view:
struct IngredientListView: View {
@FetchRequest(entity: Ingredient.entity(), sortDescriptors: [NSSortDescriptor(key: "name", ascending: true)]) var ingredients: FetchedResults<Ingredient>
var body: some View {
List {
ForEach(ingredients) { ingredient in
NavigationLink(destination: IngredientView(ingredient: ingredient)) {
Text(ingredient.name)
}
}
}
}
}
The NavigationLink just goes to a detail view with a navigationBarItem to bring up a sheet where the user can edit the name of the ingredient. Thanks for the suggestions!
Post
Replies
Boosts
Views
Activity
SquareView is called here:
// SizeRange is 1...8
struct BoardView: View {
var body: some View {
VStack(alignment: .center, spacing: 0) {
ForEach(SizeRange.reversed(), id: \.self) { row in
HStack(spacing: 0) {
ForEach(SizeRange, id: \.self) { column in
SquareView(column: column, row: row)
}
}
}
}
}
}
SquareView is called here (posted in answer as well in case it's more readable):
struct BoardView: View {
var body: some View {
VStack(alignment: .center, spacing: 0) {
ForEach(SizeRange.reversed(), id: \.self) { row in
HStack(spacing: 0) {
ForEach(SizeRange, id: \.self) { column in
SquareView(column: column, row: row)
}
}
}
}
}
}