title: How to programmatically make a List's editMode inactive when leaving the view with SwiftUI?
body: <p>Given a List view with an EditButton() in there, if the view is being edited (user tapped the Edit button), how can one disable the edit mode programmatically when the user navigates away from the view? (e.g. similar behavior to the Favorites view in the Phone app on the iPhone)</p>
  <pre><code>struct ContentView2: View {
      @State var fruits = [&quot;Apple&quot;, &quot;Banana&quot;]
  
      var body: some View {
          NavigationView {
              List {
                  ForEach(fruits, id: \.self) { fruit in
                      Text(fruit)
                  }
                  .onDelete { _ in
                      print(&quot;Delete&quot;)
                  }
              }
              .toolbar {
                  EditButton()
              }
          }
          .onDisappear {
              // make List's editMode be .inactive; how?
          }
      }
  }
  </code></pre>