标记 Google Maps SDK,Swift 2.0 的自定义信息窗口

Custom InfoWindow for marker Google Maps SDK, Swift 2.0

我正在尝试实现此 (https://www.youtube.com/watch?v=ILiBXYscsyY) 自定义信息窗口教程,该教程是为 Objective-C 在 Swift 2.0 中完成的。我试过通过混合匹配 Objective-C 和 Swift 代码来做到这一点,但我一直没有成功翻译

- (UIView *) mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker {
    CustomInfoWindow *infoWindow = [[[NSBundle MainBundle] loadNibNamed:@"InfoWindow" owner:self options:nil] objectAtIndex:0];
    infoWindow.name.text = @"Syndey Opera House";
    infoWindow.address.text = @"Bennelong Point, Sydney";
    infoWindow.photo.image = [UIImage imageNamed:@"SydneyOperaHouseAtNight"];

    return infoWindow;
}

变成 Swift。这部分教程可以在视频的 3:07 中找到。

我需要一些帮助将本教程翻译成 Swift 2.0,或者如果有人知道关于 Swift 2.0 的好教程,我们将不胜感激。

这是上面的 swift 代码:

func mapView(mapView: GMSMapView!, markerInfoWindow marker: GMSMarker!) -> UIView! {
         let infoWindow = NSBundle.mainBundle().loadNibNamed("InfoWindow", owner: self, options: nil).first as! CustomInfoWindow
        infoWindow.name.text = "Sydney Opera House"
        infoWindow.address.text = "Bennelong Point Sydney"
        infoWindow.photo.image = UIImage(named: "SydneyOperaHouseAtNight")
        return infoWindow
    }

这里是 Swift3 的代码:

func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? {
    let infoWindow = Bundle.main.loadNibNamed("InfoWindow", owner: self, options: nil)?.first as! CustomInfoWindow
    infoWindow.name.text = "Sydney Opera House"
    infoWindow.address.text = "Bennelong Point Sydney"
    infoWindow.photo.image = UIImage(named: "SydneyOperaHouseAtNight")
    return infoWindow
}