I enter the EditMode with EditButton and I want to leave it when my view disappear so the EditMode will not continue to the next view, here is my code :
@State var array = [1,2,3,4]
var body : some View {
VStack{
HStack{
Spacer()
EditButton()
}
List{
ForEach(self.array){ int in
Text(int)
}
}
}
}
When the user moves to a different view with a different list, without pressing Done on the EditButton before hand, the EditMode stays, but I want it to become .inactive.
You can use
@Environment(\.editMode)and set it to.inactiveinonDisappear: