I want to have a custom info window in my application that will appear in place of the default one when I click on a Google Maps marker. To do this, I have created a .xib file and a CustomInfoWindow.swift class that looks like this:
import UIKit
class CustomInfoWindow: UIView {
@IBOutlet var label: UIImageView!
}
However, I don't know how to get my map to show this info window when I click on the marker. I have looked here, here and here for help with no luck.
I have implemented the following code:
func mapView(mapView: GMSMapView!, markerInfoWindow marker: GMSMarker!) -> UIView! {
var infoWindow = Bundle.mainBundle().loadNibNamed("InfoWindow", owner: self, options: nil).first! as CustomInfoWindow
infoWindow.label.text = "\(marker.position.latitude) \(marker.position.longitude)"
return infoWindow
}
However, when I try to build this, I get an error saying that I "cannot call value of non-function type Bundle".