title: Passing functions with State variable to Child View
body: <p>I am trying to pass different functions to child view. For that I use <code>typalias</code> and different initialisers.</p>
  
  <p>I get an Error when I try to pass a <code>@State</code>-variable. How do I need to set the <code>Binding</code>-variable in the child view?</p>
  
  <p>Error is as follows:</p>
  
  <blockquote>
    <p>Cannot assign value of type 'Bool' to type 'Binding' </p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre class="lang-swift prettyprint-override"><code>typealias OnTabHandler = (String) -&gt; Void
  
  struct ContentView: View {
      @State var showSheet = false
  
      var onTabHandler:OnTabHandler = { text in
          print(text)
      }
  
      var body: some View{
          VStack{
              // print to console
              ChildView(text: "Hello", onTabHandler: onTabHandler)
  
              // show sheet
              ChildView()
                  .sheet(isPresented:$showSheet){ Text("sheet view")}
          }
      }
  }
  
  struct ChildView:View{
      var text:String
      var onTabHandler:OnTabHandler
      var showSheet:Binding&lt;Bool&gt;
  
      // print to console
      init(text:String, onTabHandler:@escaping OnTabHandler){
          self.text = text
          self.onTabHandler = onTabHandler
          self.showSheet = Binding.constant(false)
      }
  
      // show sheet
      init(showSheet:Binding&lt;Bool&gt;){
          self.showSheet = showSheet
          self.onTabHandler = {_ in
  
              // Error here
              self.showSheet = true
          }
          self.text = ""
      }
  
      var body: some View{
          Button("Tab Me"){
              self.onTabHandler(self.text)
          }
      }
  }
  </code></pre>