title: SwiftUI @Binding Initialize
body: <p>Been playing around with SwiftUI and understood the concept of <code>BindableObjects</code> etc so far (at least I hope I do). </p>
  
  <p>I bumped into a stupid problem I can't seem to find an answer for: 
  How do you initialize a <code>@Binding</code> variable?</p>
  
  <p>I have the following code:</p>
  
  <pre class="lang-swift prettyprint-override"><code>struct LoggedInView : View {
  
      @Binding var dismissView: Bool
  
      var body: some View {
          VStack {
              Text("Hello World")
          }
      }
  }
  </code></pre>
  
  <p>In my preview code, I want to pass that parameter of type <code>Binding&lt;Bool&gt;</code>:</p>
  
  <pre class="lang-swift prettyprint-override"><code>#if DEBUG
  struct LoggedInView_Previews : PreviewProvider {
      static var previews: some View {
          LoggedInView(dismissView: **Binding&lt;Bool&gt;**)
      }
  }
  #endif
  </code></pre>
  
  <p>How would I go an initialize it? tried:</p>
  
  <pre class="lang-swift prettyprint-override"><code>Binding&lt;Bool&gt;.init(false)
  Binding&lt;Bool&gt;(false)
  </code></pre>
  
  <p>Or even:</p>
  
  <pre class="lang-swift prettyprint-override"><code>@Binding var dismissView: Bool = false
  </code></pre>
  
  <p>But none worked... any ideas?</p>