title: How to get data from the Model and update it
body: <p>I have a data model that I want to use its data in various views. So firstly I have problem polling that information from my data model and secondly I have problem to update the data.
  Here in one example of my data model with three views.</p>
  <p><strong>Data Model</strong></p>
  <pre><code>// A basic resocrd of each exercise in a workout
  class WorkoutItem:ObservableObject, Identifiable{
      
      var id:Int = 0
      var name: String = &quot;An Exercise&quot;
      var sets:Int = 3
      var reps:Int = 10
      
      func addSet() {
          sets += 1
      }
      init(){
          
      }
      
  }
  
  // The model for holding a workout
  class WorkoutModel:ObservableObject{
      @Published var workout:[WorkoutItem] =  []
      var lastID:Int = -1
      
      /// Creates a newID based on the last known ID
      private func newId()-&gt;Int{
          lastID += 1
          return lastID
      }
      
      func add(name:String, sets:Int, reps:Int){
          let newExercise = WorkoutItem()
          
          workout += [newExercise]
      }
      
      
      init() {
          add(name: &quot;Psuh Pp&quot;, sets: 1, reps: 8)
          add(name: &quot;Pull UPs&quot;, sets: 1, reps: 10)
      }
  }
  </code></pre>
  <p><strong>View 1</strong></p>
  <pre><code>struct ContentView: View {
      @ObservedObject var myWorkout: WorkoutModel
      var body: some View {
          List(self.myWorkout.workout) { item in
              VStack(alignment: .leading) {
                  VStack(alignment: .leading) {
                      Text(item.name).font(.headline)
                      ExerciseEntryView(exItem: item)
                  }
              }
          }
      }
  }
  </code></pre>
  <p><strong>View 2</strong></p>
  <pre><code>struct ExerciseEntryView: View {
      var exItem: WorkoutItem
      var body: some View {
          VStack {
              VStack(alignment: .leading){
                  
                  ForEach(0 ..&lt; exItem.sets, id: \.self){ row in
                      ExerciseEntryView_Row(setNumber: row)
                  }
                  
              }
              Button(action: {
                  self.exItem.addSet()
              }) {
                  Text(&quot;Add Set&quot;).foregroundColor(Color.red)
              }
          }
      }
  }
  </code></pre>
  <p><strong>View 3</strong></p>
  <pre><code>struct ExerciseEntryView_Row: View {
      var setNumber: Int
      var body: some View {
          HStack{
              Text(&quot;Set Number \(setNumber)&quot;)
          }
      }
  }
  </code></pre>
  <p>Firstly when running the code, as you can see in the below image the title is still the default value ('An Exercise') while it should <code>Pull up</code> and <code>Push up</code>.  Also when I press on <code>add set</code> the set gets updated in the terminal but it does not update the view.</p>
  <p>Any idea why this is not functioning?</p>
  <p>Thanks in advance.<br />
  <a href="https://i.stack.imgur.com/tMGAe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tMGAe.png" alt="Screenshot of the app" /></a></p>