title: Why doesn't my swift ui view update after I change a State var?
body: <p>I'm new to Swift development, and I'm trying to make a View, where you can click an item and it gets bigger, while the old big item gets smaller. I'm using an @State var called chosen to know which Element should be big at the moment. The items itself are Views with a Button on top. The idea is, that I click the button and the button will change the chosen variable, which is working. But it seems that my view doesn't redraw itself and everything stays as is. The simplified pseudocode looks like this:</p>
  <pre><code>struct MyView: View {
      @State var chosen = 0
      
      var body: some View {
          VStack(){
              ForEach(0 ..&lt; 4) { number in
                  if self.chosen == number {
                          DifferentView()
                              .frame(big)
                              .clipShape(big)
                  }else{
                      ZStack{
                          DifferentView()
                              .frame(small)
                              .clipShape(small)
                          Button(action: {self.chosen = number}){Rectangle()}
                      }
                  }
              }
          }
      }
  
  </code></pre>