I used the sample code of Apple. However I can toggle the EditMode button all I want, but it won’t update the Form accordingly. Is this a bug or am I not using it right?
struct ContentView: View {
@Environment(.editMode) private var editMode
@State private var name = "Maria Ruiz"
var body: some View {
NavigationStack {
Form {
if editMode?.wrappedValue.isEditing == true {
TextField("Name", text: $name)
.background(.blue)
} else {
Text(name)
.background(.red)
}
}
.animation(nil, value: editMode?.wrappedValue)
.toolbar {
EditButton()
}
}
}
}