title: @State var doesn't store value
body: <p>My goal is to pass values between views, from Chooser to ThemeEditor. When the user presses an icon, I'm saving the object that I want to pass and later, using <code>sheet</code> and passing the newly created view with the content of the <code>@State var</code>.</p>
  <p>The assignment is done successfully to the <code>@State var themeToEdit</code>, however it is <code>nil</code> when the <code>ThemeEditor</code> view is created in the <code>sheet</code></p>
  <p>What am I doing wrong?</p>
  <pre><code>struct Chooser: View {
      @EnvironmentObject var store: Store
      
      @State private var showThemeEditor = false
      @State private var themeToEdit: ThemeContent?
      @State private var editMode: EditMode = .inactive
      @State private var isValid = false
      
      var body: some View {
          
          NavigationView {
              List {
                  ForEach(self.store.games) { game in
                      NavigationLink(destination: gameView(game))
                      {
                          Image(systemName: &quot;wrench.fill&quot;)
                              .imageScale(.large)
                              .opacity(editMode.isEditing ? 1 : 0)
                              .onTapGesture {
                                  self.showThemeEditor = true
                                  /* themeInfo is of type struct ThemeContent: Codable, Hashable, Identifiable */
                                  self.themeToEdit = game.themeInfo 
                              }
                          VStack (alignment: .leading) {
                              Text(self.store.name(for: something))
                                  
                              HStack{
                                  /* some stuff */
                                  Text(&quot; of: &quot;)
                                  Text(&quot;Interesting info&quot;)
                              }
                          }
                      }
                  }
                  .sheet(isPresented: $showThemeEditor) {
                      if self.themeToEdit != nil { /* &lt;&lt; themeToEdit is nil here - always */
                          ThemeEditor(forTheme: self.themeToEdit!, $isValid)
                      } 
                  }
              }
              .environment(\.editMode, $editMode)
          }
      }
  }
  
  
  struct ThemeEditor: View {
      @State private var newTheme: ThemeContent
      @Binding var isValid: Bool
      @State private var themeName = &quot;&quot;
      
      init(forTheme theme: ThemeContent, isValid: Binding&lt;Bool&gt;) {
          self._newTheme = State(wrappedValue: theme)
          self._validThemeEdited = isValid
      }
      var body: some View {
             ....
      }
  }
  
  struct ThemeContent: Codable, Hashable, Identifiable {
  /* stores simple typed variables of information */
  }
  </code></pre>