title: iOS Swift: how to check if Object exists in an Array so I don't add it to it, or re-create a GMSMarker with it?
body: <p>I've been working with gmaps for iOS sdk and have this problem: each time the map pans or zooms <em>and finishes</em>(Im using the Delegate <em>idleAtCameraPosition</em>) in my serverside I compare the coordinates of the center of the map, in order to mark pins of places around it.  I save the places in an array of "Places" objects, when they are close enough(1km) from the center coordinates.  </p>
  
  <p>My problem is that I haven't been able to avoid adding repeated objects to the array, so every time I do pan the map but don't change the camera position that much, the existing markers in the screen are re-added to the Places array.  I tried using this code, but it doesn't work and the array can grow infinitely until crashing the app:</p>
  
  <pre><code>   if(!arrayProp.contains(place)){
        arrayProp.append(place)
     }
  </code></pre>
  
  <p>but it doesn't work.</p>
  
  <p>I also have another array of GMSMarkers that feeds itself from the Places array; tried this code to avoid re-creating markers in the map with Places objects that already existed:</p>
  
  <pre><code>for place in arrayProp {
                  let pinPlace = PlaceMarker(propied: place)//custom GMSMarker class
                  if(self.markerArray.contains(pinPlace) == false ) {
                      self.markerArray.append(pinPlace)
                      pinPlace.map = self.mapaGoogle
                  } else {
                      pinPlace.map = nil
                  }
              }
  </code></pre>
  
  <p>Any help would be greatly appreciated; thank you</p>