title: How can I filter an array in SwiftUI?
body: <p>I am making an application in which I want to filter an array of workout data more times.</p>
  
  <p>I used to do it by the help of filter, map, for loop in UIKit, but in SwiftUI no luck.</p>
  
  <pre><code>List {
      if workoutsModel.workoutsAreFiltered {
          ForEach(workoutsModel.workoutsFilter) { workoutFilter in
              if workoutFilter.isOn {
                  ForEach(self.workoutsModel.workout) { workout in
                      if workoutFilter.name == workout.goal || workout.muscles.contains(workoutFilter.name) {
                          WorkoutsRow(workout: workout)
                      }
                  }
              }
          }
      } else {
          ForEach(self.workoutsModel.workout) { workout in
              WorkoutsRow(workout: workout)
          }
      }
  }
  </code></pre>