title: Filtering an API Request Response by an object array?
body: <p>I am making an API call for muscles relating to an exercise, the call looks like this:</p>
  
  <pre><code>    func loadPrimaryMuscleGroups(primaryMuscleIDs: [Int]) {
      print(primaryMuscleIDs)
      let url = "https://wger.de/api/v2/muscle"
      Alamofire.request(url).responseJSON { response in
          let jsonData = JSON(response.result.value!)
          if let resData = jsonData["results"].arrayObject {
              let resData1 = resData as! [[String:AnyObject]]
              if resData1.count == 0 {
                  print("no primary muscle groups")
                  self.musclesLabel.isHidden = true
              } else {
                  print("primary muscles used for this exercise are")
                  print(resData)
                  self.getMuscleData(muscleUrl: resData1[0]["name"] as! String)
              }
          }
      }
  }
  </code></pre>
  
  <p>This returns me a whole list of all the muscles available, I need it to just return the muscles the exercise requires. This is presented in exercises as an array of muscle id's, which I feed in via the viewDidLoad below</p>
  
  <pre><code>self.loadPrimaryMuscleGroups(primaryMuscleIDs: (exercise?.muscles)!)
  </code></pre>
  
  <p>So I am feeding the exercises muscle array into the func as an [Int] but at this point im stumped on how to filter the request so that the resulting muscle data are only the ones needed for the exercise.</p>
  
  <p>I was thinking it would be something like using primaryMuscleIDs to filter the id property of a muscle in the jsonData response, but im not sure how to go about that?</p>
  
  <p>Thanks for any clarify here, hopefully I have explained it clearly enough to come across well</p>