Post

Replies

Boosts

Views

Activity

Reply to Updating item in nested observed array with swiftUI
this peace of code swift ForEach(eventsVM.events[eventIndex].todos) { todo in HStack {          Image(systemName: todo.done ? "checkmark.square" : "square")                .resizable()                .frame(width: 24, height: 24)                .foregroundColor(todo.done ? .blue : .gray)                .font(.system(size: 20, weight: .regular, design: .default))           Text(todo.title)           Spacer()       }.padding(5.0)      .onTapGesture(perform: {            todo.done.toggle()       }) } this will result in this error ""Cannot use mutating member on immutable value: 'todo' is a 'let' constant""
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’21