title: how to check if a property value exists in array of objects in swift
body: <p>I am trying to check if a specific item (value of a property) exists in a array of objects, but could not find out any solution. Please let me know, what i am missing here.</p>
  
  <pre><code>        class Name {
              var id : Int
              var name : String
              init(id:Int, name:String){
                  self.id = id
                  self.name = name
              }
          }
  
          var objarray = [Name]()
          objarray.append(Name(id: 1, name: "Nuibb"))
          objarray.append(Name(id: 2, name: "Smith"))
          objarray.append(Name(id: 3, name: "Pollock"))
          objarray.append(Name(id: 4, name: "James"))
          objarray.append(Name(id: 5, name: "Farni"))
          objarray.append(Name(id: 6, name: "Kuni"))
  
          if contains(objarray["id"], 1) {
              println("1 exists in the array")
          }else{
              println("1 does not exists in the array")
          }
  </code></pre>