title: SwiftUI pass data to subview
body: <p>So I have read a lot about swiftUI and I am confused. I understand the <code>@State</code> and how it update the view behind the scenes. The thing I can't understand is why when I the subview in this example is automatically updated when the state changes in the top view/struct given the fact that on the subview the var <code>subname</code> is not a <code>@State</code> property. I would expect this not to be updated. Can someone enlighten me please?</p>
  <pre><code>import SwiftUI
  
  struct SwiftUIView: View {
      @State private var name = &quot;George&quot;
      var body: some View {
          VStack{
              SubView(subName: name).foregroundColor(.red)
              Button(action: {
                  self.name = &quot;George2&quot;
              }) {
                  Text(&quot;Change view name&quot;)
              }
          }
      }
  }
  
  struct SubView: View {
      var subName:String
      var body: some View {
          Text(subName)
      }
  }
  
  struct SwiftUIView_Previews: PreviewProvider {
      static var previews: some View {
          SwiftUIView()
      }
  }
  
  </code></pre>
  <p>PS.
  If I change the subview to</p>
  <pre><code>struct SubView: View {
      @State var subName:String
      var body: some View {
          Text(subName)
      }
  }
  </code></pre>
  <p>it's not updated when I press the button.</p>