i using code for swift version 3. and I change contain view that i add subview of UIImageView to containView. 
Adding two button on google map. and I use code of Lithium with on the top. 
func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
    if marker.title != nil {
        let mapViewHeight = mapView.frame.size.height
        let mapViewWidth = mapView.frame.size.width
        let container = UIView()
        container.frame = CGRect.init(x: mapViewWidth - 100, y: mapViewHeight - 63, width: 65, height: 35)
        container.backgroundColor = UIColor.white
        self.view.addSubview(container)
        let googleMapsButton = CustomButton()
        googleMapsButton.setTitle("", for: .normal)
        googleMapsButton.setImage(UIImage(named: "googlemaps")?.resizableImage(withCapInsets: UIEdgeInsets.init(top: 0, left: 0, bottom: 50, right: 50)),for: .normal)
        googleMapsButton.setTitleColor(UIColor.blue, for: .normal)
        googleMapsButton.frame = CGRect.init(x: mapViewWidth - 80, y: mapViewHeight - 70, width: 50, height: 50)
        googleMapsButton.addTarget(self, action: #selector(self.markerClick(sender:)), for: .touchUpInside)
        googleMapsButton.gps = String(marker.position.latitude) + "," + String(marker.position.longitude)
        googleMapsButton.title = marker.title
        googleMapsButton.tag = 0
        let directionsButton = CustomButton()
        directionsButton.setTitle("", for: .normal)
        directionsButton.setImage(UIImage(named: "googlemapsdirection")?.resizableImage(withCapInsets: UIEdgeInsets.init(top: 0, left: 0, bottom: 50, right: 50)),for: .normal)
        directionsButton.setTitleColor(UIColor.blue, for: .normal)
        directionsButton.frame = CGRect.init(x:mapViewWidth - 110, y:mapViewHeight - 70, width:50, height: 50)
        directionsButton.addTarget(self, action: #selector(self.markerClick(sender:)), for: .touchUpInside)
        directionsButton.gps = String(marker.position.latitude) + "," + String(marker.position.longitude)
        directionsButton.title = marker.title
        directionsButton.tag = 1
        self.view.addSubview(googleMapsButton)
        self.view.addSubview(directionsButton)
    }
    return false
}
func markerClick(sender:CustomButton){
    let fullGPS = sender.gps
    let fullGPSArr = fullGPS!.characters.split{$0 == ","}.map(String.init)
    let lat1 : String = fullGPSArr[0]
    let lng1 : String = fullGPSArr[1]
    guard let lat1_double = Double(lat1),let lng1_double = Double(lng1) else{
        return
    }
    let latitude:CLLocationDegrees =  lat1_double
    let longitude:CLLocationDegrees =  lng1_double
    if (UIApplication.shared.openURL(URL(string:"comgooglemaps://")!)) {
        if (sender.tag == 1) {
            UIApplication.shared.openURL(URL(string:
                "comgooglemaps://?saddr=&daddr=\(latitude),\(longitude)&directionsmode=driving")!)
        } else if (sender.tag == 0) {
            UIApplication.shared.openURL(URL(string:
                "comgooglemaps://?center=\(latitude),\(longitude)&zoom=14&views=traffic")!)
        }
    } else {
        let regionDistance:CLLocationDistance = 10000
        let coordinates = CLLocationCoordinate2DMake(latitude, longitude)
        let regionSpan = MKCoordinateRegionMakeWithDistance(coordinates, regionDistance, regionDistance)
        var options : NSDictionary! = nil
        if (sender.tag == 1) {
            options = [
                MKLaunchOptionsMapCenterKey: NSValue.init(mkCoordinate: regionSpan.center),
                MKLaunchOptionsMapSpanKey: NSValue(mkCoordinateSpan: regionSpan.span),
                MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving
            ]
        } else if (sender.tag == 0) {
            options = [
                MKLaunchOptionsMapCenterKey: NSValue(mkCoordinate: regionSpan.center),
                MKLaunchOptionsMapSpanKey: NSValue(mkCoordinateSpan: regionSpan.span)
            ]
        }
        let placemark = MKPlacemark(coordinate: coordinates, addressDictionary: nil)
        let mapItem = MKMapItem(placemark: placemark)
        mapItem.name = sender.title
        mapItem.openInMaps(launchOptions: options as? [String : Any])
    }
}