title: ForEach loop inside a button action in SwiftUI?
body: <p>I understand that a ForEach loop is typically used to display a view. When I put a ForEach loop inside the action button it pretty much tells me Button action cannot conform to the view protocol. So how can I use a loop to make the button carry out multiple actions?</p>
  
  <pre><code>struct SomeView: View {
      var newExercises = [NewExercise]()
      var finalExercises = [Exercise]()
  
      var body: some View {
          Button(action: {
              ForEach(newExercises) { newExercise in
                  //.getExercise() returns an Exercise object
                  finalExercises.append(newExercise.getExercise())
              }
  
          }) {
              Text("Done")
          }
      }
  }
  
  </code></pre>
  
  <p>I want the button to add an Exercise (by calling .getExercise()) to the finalExercises array for each newExercise in the newExercises array.</p>
  
  <p>How can I go about doing this?</p>