title: How to filter markers on GoogleMapView using CollectionView items in IOS Swift 4
body: <p>I have used googleMapView in my iOS application, I am placing markers in random places by doing This: </p>
  
  <pre><code>struct location {
      let icon: UIImage
      let latitude : CLLocationDegrees
      let longitude : CLLocationDegrees
  }
  
  class MapViewController: UIViewController,GMSMapViewDelegate,CLLocationManagerDelegate {
    let locations = [
          location(icon: UIImage(named :"beautycare.png")!, latitude: 36.771873, longitude: -119.750724),
          location(icon: UIImage(named :"childcare.png")!, latitude: 36.771930, longitude: -119.761352),
          location(icon: UIImage(named :"carpentry.png")!, latitude: 36.772243, longitude: -119.774393),
          location(icon: UIImage(named :"education.png")!, latitude: 36.772499, longitude: -119.739129),
          location(icon: UIImage(named :"plumbing.png")!, latitude: 36.781273, longitude: -119.793848),
          location(icon: UIImage(named :"massage.png")!, latitude: 36.781433, longitude: -119.723345),
          location(icon: UIImage(named :"childcare.png")!, latitude: 36.781569, longitude: -119.830231),
          location(icon: UIImage(named :"security.png")!, latitude: 36.782312, longitude: -119.767465),
          location(icon: UIImage(named :"cleaning.png")!, latitude: 36.782933, longitude: -119.814373),
          location(icon: UIImage(named :"beautycare.png")!, latitude: 36.783156, longitude: -119.794719),
          location(icon: UIImage(named :"carpentry.png")!, latitude: 36.783873, longitude: -119.363839),
          location(icon: UIImage(named :"massage.png")!, latitude: 36.784289, longitude: -119.738238),
          location(icon: UIImage(named :"education.png")!, latitude: 36.793321, longitude: -119.738920),
          location(icon: UIImage(named :"childcare.png")!, latitude: 36.796312, longitude: -119.749201),
          location(icon: UIImage(named :"beautycare.png")!, latitude: 36.799893, longitude: -119.798301),
          location(icon: UIImage(named :"plumbing.png")!, latitude: 36.803455, longitude: -119.821022),
          location(icon: UIImage(named :"massage.png")!, latitude: 36.803953, longitude: -119.873910),
          location(icon: UIImage(named :"carpentry.png")!, latitude: 36.804273, longitude: -119.801032),
          location(icon: UIImage(named :"plumbing.png")!, latitude: 36.807721, longitude: -119.834747),
          location(icon: UIImage(named :"beautycare.png")!, latitude: 36.809213, longitude: -119.749321)]
  
     override func viewWillAppear(_ animated: Bool) {
  
          for location in locations {
  
              let marker = GMSMarker()
              marker.position = CLLocationCoordinate2DMake(location.latitude,location.longitude)
              marker.icon = location.icon
              marker.appearAnimation = GMSMarkerAnimation.pop
              marker.map = googleMapView
          }
   }
  </code></pre>
  
  <p>Now I have a horizontal collectionView in my ViewController where there are services with respective Image and service name.</p>
  
  <p>Now, when I click on any item in collectionView, it should filter the icon at the locations based on the service I selected in collectionView.</p>