title: SwiftUI EditButton action on Done
body: <p>How do you set an action to perform when the user hits the <code>EditButton</code> when it appears as "Done"?  Is it even possible to do so?</p>
  
  <p>Note that this is not the same as performing an action at each of the individual edits the user might do (like <code>onDelete</code> or <code>onMove</code>).  How do you set an action to perform when the user is finished making all changes and ready to commit them?</p>
  
  <p>It's necessary because I'm making all changes on a temporary copy of the model and will not commit the changes to the actual model until the user hits "Done".  I am also providing a "Cancel" Button to discard the changes.</p>
  
  <pre><code>struct MyView: View {
      @Environment(\.editMode) var mode
  
      var body: some View {
          VStack {
              HStack {
                  if self.mode?.value == .active {
                      Button(action: {
                          // discard changes here
                          self.mode?.value = .inactive
                      }) {
                          Text("Cancel")
                      }
                  }
  
                  Spacer()
  
                  EditButton()
                  // how to commit changes??
              }
              // controls to change the model
          }
      }
  }
  </code></pre>
  
  <p>Is it even possible to set an action for "Done" on the <code>EditButton</code> or would I have to provide my own button to act like an <code>EditButton</code>?  I could certainly do that, but it seems like it should be easy to do with the <code>EditButton</code>. </p>