title: How do you access & edit an @AppStorage var from multiple other views in SwiftUI 2.0?
body: <p>Is there a better way to do this? Is there a way to access the UserDefaults in the environment??  I did the following:</p>
  <pre><code>struct ContentView: View {
      @AppStorage(&quot;darkMode&quot;) var darkMode = false
  
      var body: some View {
              SubView(darkMode: $darkMode)
          }
      }
  }
  
  struct SubView: View {
      @Binding var darkMode: Bool
      var body: some View {
          Text(&quot;Dark Mode is \(darkMode == true ? &quot;on&quot; : &quot;off&quot;)&quot;)
      }
  }
  </code></pre>