I am trying to create my own info window for markers on my map. To do this, I created View.xib to configure it the way I need, and I call it from the class in which the map is implemented. The map is displayed, two markers, but without result when I tap on the markers. How can I correctly name this point ??
class MapView: UIView,CLLocationManagerDelegate,GMSMapViewDelegate {
@IBOutlet var contentView: UIView!
let mapView = GMSMapView(frame: CGRect.zero,camera: GMSCameraPosition.camera(withTarget: CLLocationCoordinate2D(latitude: -33.86, longitude: 151.20), zoom: 12))
var marker1 = GMSMarker()
var marker2 = GMSMarker()
override init(frame: CGRect) {
    super.init(frame: frame)
    initView()
}
required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    initView()
}
private func initView() {
    Bundle.main.loadNibNamed("MapView", owner: self, options: nil)
    contentView = mapView
    markers()
    addSubview(mapView)
    contentView.frame = self.bounds
    mapView.delegate = self 
}
func markers()
{
    marker1.position = CLLocationCoordinate2D(latitude: -33.861, longitude: 151.20)
    marker1.map = mapView
    marker1.userData = ["marker": "1"]
    marker2.position = CLLocationCoordinate2D(latitude: -33.859, longitude: 151.21)
    marker2.map = mapView
    marker2.userData = ["marker": "2"]
}
func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
    var markerData : [String:Any]?
    if let data = marker.userData as? [String:Any] {
        markerData = data
    }
    print(#function, "\(markerData?["marker"] as? String ?? "")")
    return true
    }
  func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? {
        return UINib(nibName: "customInfoWindowView", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! customInfoWindowView
    }
}
customInfoWindowView.swift
class customInfoWindowView: UIView {
    @IBOutlet weak var contentView:UIView!
    override init(frame: CGRect) {
        super.init(frame: frame)
        initView()
    }
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        initView()
    }
    private func initView() {
        Bundle.main.loadNibNamed("customInfoWindowView", owner: self, options: nil)
        addSubview(contentView)
        contentView.frame = self.bounds
    }
}
 
    