title: How to identify which GMSMarker was tapped - iOS, Swift
body: <p>I'm quite new to Swift and i'm trying to better understand Google Maps API. I'm building a simple app that shows images when markers on panoramaView are tapped through didTapMarker method. Since each marker should show a different images, i'm trying to find a way to identify which marker has been tapped, a sort of marker tag. 
  All suggestions are welcome. </p>
  
  <p>Down here is a prototype of the code with 2 markers and 2 images. Not really sure how to do it, but didTapMarker method should show <code>randomImage</code> when <code>marker</code> is tapped and <code>randomImage2</code> when <code>marker2</code> is tapped. So far it only shows <code>randomImage</code> when both <code>marker</code> and <code>marker1</code> are tapped. </p>
  
  <pre><code>import UIKit
  import GoogleMaps
  
  class ViewController: UIViewController, GMSPanoramaViewDelegate {
  
  @IBOutlet weak var viewStreet: UIView!
  @IBOutlet weak var randomImage: UIImageView!
  @IBOutlet weak var randomImage2: UIImageView!
  
  var panoView: GMSPanoramaView!
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      randomImage.hidden = true
      randomImage2.hidden = true
  
      let panoView = GMSPanoramaView(frame: CGRectMake(200, 200, 400, 400))
      panoView.delegate = self
      panoView.moveNearCoordinate(CLLocationCoordinate2D(latitude: -33.732, longitude: 150.312))
  
      viewStreet.addSubview(panoView)
      viewStreet.sendSubviewToBack(panoView)
  
      let position = CLLocationCoordinate2D(latitude: -33.732, longitude: 150.312)
      let marker = GMSMarker(position: position)
      marker.panoramaView = panoView
  
      let position2 = CLLocationCoordinate2D(latitude: -33.732, longitude: 150.311)
      let marker2 = GMSMarker(position: position2)
      marker2.panoramaView = panoView
  }
  
  func panoramaView(panoramaView: GMSPanoramaView, didTapMarker marker: GMSMarker) -&gt; Bool {
  
      randomImage.hidden = false
      randomImage2.hidden = true
      return true
  }
  }
  </code></pre>
  
  <p>EDIT: solved, thanks to everyone, i'm adding a trivial example on how to do it then. </p>
  
  <pre><code> marker.userData = "example" 
  </code></pre>
  
  <p>Then <code>didTapMarker</code> method is always called when a marker is tapped, but <code>randomImage</code> 's propriety is set to false only when the marker tapped is the one above.</p>
  
  <pre><code> func panoramaView(panoramaView: GMSPanoramaView, didTapMarker marker: GMSMarker) -&gt; Bool {
  
      if marker.userData as? String == "example" {
           randomImage.hidden = false
      }
      return true
  }
  </code></pre>
  
  <p>Code can be improved making use of a dictionary to handle multiple markers but it's up to you. :)</p>