title: SwiftUI Child Views not updating as expected with environmentObject
body: <p>Please see my example provided, I have recreated my pattern as accurately as possible while leaving out details that are not relevant to the question.</p>
  <p>I have <code>@Published</code> property variables in my viewmodel which are updated/assigned after a fetch to firebase. Each time one of the root or child views is accessed, the fetch logic runs (or takes from cache), and then maps my values to the <code>@Published</code> dictionaries I have in my view model. What concerns me, is that my <code>CardView</code> always updates successfully, while my <code>AlternateCardView</code> only gets the correct values from my dictionary on first load, but never again unless I kill the app.</p>
  <p>Am I missing an obvious best-practice here? Is there a better way to implement my pattern to avoid this bug? I'd like my <code>AlternateCardView</code> to update whenever a change is detected, and I have verified that my viewmodel is indeed updating the values - they're just not translating into my view.</p>
  <p><em>Please note: I have also tried this solution using a managed collection of custom defined Structs instead of the literal dictionaries presented in my example. Despite that, the bug I am describing still persisted - so I am sure that is not the issue. I did this because I thought it would guarantee firing <code>objectWillChange</code>, but I wonder if I am actually running into a weird quip with SwiftUI.</em></p>
  <p>I am using Xcode Version 13.2.1, Swift5.1, and running on iOS15 iPhone 11 simulator.</p>
  <p><strong>Content view:</strong></p>
  <pre><code>struct ContentView: View {
      // ...
      var body: some View {
          VStack {
              RootView().environmentObject(ProgressEngine())
          }
      }
  }
  </code></pre>
  <p><strong>Root view:</strong></p>
  <pre><code>struct RootView: View {
      @EnvironmentObject var userProgress: ProgressEngine
  
      var body: some View {
          VStack {
              NavigationLink(destination: ChildView().environmentObject(self.userProgress)) {
                CardView(progressValue: self.$userProgress.progressValues)
              }
          }
          .onAppear {
              self.userProgress.fetchAllProgress() // This is fetching data from firebase, assigns to my @Published properties
          }
      }
  }
  </code></pre>
  <p><strong>Card view:</strong></p>
  <pre><code>// This view works and updates all the time, successfully - no matter how it is accessed
  struct CardView: View {
      @EnvironmentObject var userProgress: ProgressEngine
      @Binding var progressVals: [String: CGFloat] // binding to a dict in my viewmodel
      var body: some View {
          VStack {
              // just unwrapping for example
              Text(&quot;\(self.userProgress.progressValues[&quot;FirstKey&quot;]!)&quot;) 
          }
      }
  }
  </code></pre>
  <p><strong>Child view:</strong></p>
  <pre><code>struct ChildView: View {
      @EnvironmentObject var userProgress: ProgressEngine
      @EnvironmentObject var anotherObject: AnotherEngine
      VStack {
          // I have tried this both with a ForEach and also by writing each view manually - neither works
          ForEach(self.anotherObject.items.indices, id: \.self) { index in 
              NavigationLink(destination: Text(&quot;another view&quot;).environmentObject(self.userProgress)) {
                  // This view only shows the expected values on first load, or if I kill and re-load the app
                  AlternateCardView(userWeekMap: self.$userProgress.weekMap)
              }
          }
      }
      .onAppear {
          self.userProgress.fetchAllProgress()
          self.userProgress.updateWeekMap()
  }
  
  </code></pre>
  <p><strong>AlternateCardView:</strong></p>
  <pre><code>// For this example, this is basically the same as CardView, 
  // but shown as a unique view to replicate my situation
  struct AlternateCardView: View {
      @EnvironmentObject var userProgress: ProgressEngine
      @Binding var weekMap: [String: [String: CGFloat]] 
      var body: some View {
          VStack {
              // just unwrapping for example
              // defined it statically for the example - but dynamic in my codebase
              Text(&quot;\(self.userProgress.weekMap[&quot;FirstKey&quot;]![&quot;WeekKey1&quot;]!)&quot;) 
          }
      }
  }
  </code></pre>
  <p><strong>View model:</strong></p>
  <pre><code>class ProgressEngine: ObservableObject {
  
      // Accessing values here always works
      @Published var progressValues: [String: CGFloat] = [
          &quot;FirstKey&quot;: 0,
          &quot;SecondKey&quot;: 0,
          &quot;ThirdKey&quot;: 0
      ]
      
      // I am only able to read values out of this the first time view loads
      // Any time my viewmodel updates this map, the changes are not reflected in my view
      // I have verified that these values update in the viewmodel in time,
      // To see the changes, I have to restart the app
      @Published var weekMap: [String: [String: CGFloat]] = [
          &quot;FirstKey&quot;: [
              &quot;WeekKey1&quot;: 0,
              &quot;WeekKey2&quot;: 0,
              &quot;WeekKey3&quot;: 0,
              .....,
              .....,
           ],
           &quot;SecondKey&quot;: [
              .....,
              .....,
           ],
           &quot;ThirdKey&quot;: [
              .....,
              .....,
           ]
      ]
  
      func fetchAllProgress(...) { 
          // do firebase stuff here ...
  
          // update progressValues
      }
  
      func updateWeekMap(...) {
          // Uses custom params to map data fetched from firebase to weekMap
      }
  }
  </code></pre>