title: In SwiftUI how do I set the environment variable of editMode in an XcodePreview
body: <p>Given a navigation stack hierarchy like this where the edit button is added in another source file</p>
  
  <pre><code>struct ContentView : View {
    var body: some View {
      NavigationView {
        EditingView()
      }.navigationBarItems(trailing: EditButton())
  
    }
  }
  </code></pre>
  
  <p>And the view that uses the edit button is elsewhere in the codebase</p>
  
  <pre><code>struct EditingView : View {
  
    @State var dataValue: String = "Initial Value"
    @Environment(\.editMode) var editMode
  
      var body: some View {
        VStack(alignment: .leading) {
          if self.editMode?.value == .inactive {
            Text(dataValue)
          } else {
            TextField(($dataValue))
          }
        }.padding()
          .navigationBarTitle("Lets edit some State")
          .navigationBarItems(trailing: EditButton())
    }
  }
  </code></pre>
  
  <p>Can I programmatically set the initial editing mode in the preview? Is there a way to view the EditingView without an editing button using the environment? A few ways I have found that work are shown in the snippet but I would hope that I can find a method to set and initial value  programmatically with the environment.</p>
  
  <pre><code>#if DEBUG
  struct EditingView_Previews : PreviewProvider {
    static var previews: some View {
      NavigationView {
        VStack {
          EditingView()
  
          // I would prefer to use an environment variable.
          // Here is the best thought at some code:
          //
          //   `.environment(\.editMode, .inactive)`
          //
          // the compiler Error returned:
          // Type 'Binding&lt;EditMode&gt;?' has no member 'inactive'
          //
          // which I understand since it is a binding
          // not a direct access to an enum variable.
          // But can I set it somehow or should I let the system
          // handle it entirely?
  
          // So to get around the issue I have an extra edit button
          EditButton()
  
        }
      }
    }
    // Or this could work
    //.navigationBarItems(trailing: EditButton())
  }
  #endif
  </code></pre>
  
  <p>An Example project can be found here:
  <a href="https://github.com/PaulWoodIII/PreviewEditMode" rel="noreferrer">https://github.com/PaulWoodIII/PreviewEditMode</a></p>