title: Swift - Get Object in Array By Property
body: <p>I'm new to Swift and I am having a few problems with retrieving an object in an array by property. </p>
  
  <p>Please note, I am using Swift 2.0.</p>
  
  <p>I have the following array;</p>
  
  <pre><code>//Dummy Data prior to database call:
  static var listPoses = [
      YogaPose(id: 1, title: "Pose1", description: "This is a Description 1", difficulty: Enums.Difficulty.Beginner, imageURL: "Images/Blah1"),
      YogaPose(id: 2, title: "Pose2", description: "This is a Description 2", difficulty: Enums.Difficulty.Advanced, imageURL: "Images/Blah2"),
      YogaPose(id: 3, title: "Pose3", description: "This is a Description 3", difficulty: Enums.Difficulty.Intermediate, imageURL: "Images/Blah3"),
      YogaPose(id: 3, title: "Hello World", description: "This is a Description 3", difficulty: Enums.Difficulty.Intermediate, imageURL: "Images/Blah3")
  ] 
  </code></pre>
  
  <p>I now have a method that I'd like to return an object by Id. Can someone please advise how I would do so ... e.g. where listPose.Id === Id;</p>
  
  <pre><code> //Returns a single YogaPose By Id:
  class func GetPosesById(Id: Int) -&gt; YogaPose{
  
  
      if(listPoses.count &gt; 0){
          return listPoses() ...
      }
  
  }
  </code></pre>