title: Updating PresentationMode value for child view from parent
body: <p>I want update <strong>presentationMode</strong> with environment modifier to update childView, in the parent view presentationMode key asks for a Binding to <strong>PresentationMode</strong> I also made that, but the Xcode does not help to make the code get fixed, here what I tried so far:</p>
  <pre><code>struct ContentView: View {
      
      @State private var presentationMode: PresentationMode
  
      var body: some View {
  
          MyTestView()
              .environment(\.presentationMode, $presentationMode)
          
          Button(&quot;update&quot;) {
              
              presentationMode.wrappedValue.isPresented.toggle()
          }
   
      }
  }
  
  struct MyTestView: View {
      
      @Environment(\.presentationMode) var presentationMode
      
      var body: some View {
          
          if presentationMode.wrappedValue.isPresented { Text(&quot;Hello, world!&quot;) }
          
      }
  }
  </code></pre>
  <p>error 1:</p>
  <blockquote>
  <p>Key path value type 'WritableKeyPath&lt;EnvironmentValues, Binding&gt;' cannot be converted to contextual type 'KeyPath&lt;EnvironmentValues, Binding&gt;'</p>
  </blockquote>
  <p>error 2:</p>
  <blockquote>
  <p>Cannot use mutating member on immutable value: 'isPresented' is a get-only property</p>
  </blockquote>
  <p>I do not think error2 should be happen because presentationMode is a State in parent view!</p>