title: Declare array property with @published var inside same ObservableObject
body: <p>I'm trying to declare Array with a @Published var property. However, the value is never updated (Always the default -&gt; 0).</p>
  <p>How can I do that ? What am I doing wrong ?</p>
  <p>Thank you very much for your help ;)</p>
  <p>Have a nice day</p>
  <pre><code>struct MyCategory: Identifiable, Hashable {
      let id = UUID()
      let name: String
      let amount: Double
  }
  
  class MyViewModel: ObservableObject {
      
      @Published var amount1: Double = 0
      @Published var amount2: Double = 0
      @Published var categories = [MyCategory]()
      
      init() {
          self.categories = [
              MyCategory(name: &quot;Test 1&quot;, amount: self.amount1),
              MyCategory(name: &quot;Test 2&quot;, amount: self.amount2)
          ]
      }
  
      func updateAmounts(value1: Double, value2: Double) {
          self.amount1 += value1
          self.amount2 += value2
      }
  }
      
  </code></pre>
  <pre><code>import SwiftUI
  
  struct MyView: View {
      
      @EnvironmentObject var myViewModel: MyViewModel
      
      var body: some View {
          ScrollView(.vertical, showsIndicators: false) {
              ForEach(myViewModel.categories, id: \.self) { category in
                  HStack() {
                       Text(&quot;\(category.name)&quot;)
                       Text(&quot;\(category.amount)&quot;) // Value not refresh! 0
                  }
              }
          }
      }
  }
  </code></pre>