enter image description hereI assigned a photo to the marker in Google Map, but on a square shape, how to make it round, as in the screenshot? And how to make a pop-up window by clicking on the marker with the information of this user?

import UIKit
import GoogleMaps

class SecondViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Create a GMSCameraPosition that tells the map to display the
        // coordinate -33.86,151.20 at zoom level 6.
        let camera = GMSCameraPosition.camera(withLatitude: 48.4811403, longitude: 35.0687614, zoom: 15.0)
        let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
        view = mapView

        // Creates a marker in the center of the map.
        let marker = GMSMarker()
        marker.position = CLLocationCoordinate2D(latitude: 48.4811403, longitude: 35.0687614)
        marker.title = "Alexei"
        marker.snippet = "From here"
        marker.map = mapView
        marker.icon = Person.shared.personImage
        marker.icon = self.imageWithImage(image: Person.shared.personImage!, scaledToSize: CGSize(width: 35.0, height: 35.0))

    }

    func imageWithImage(image:UIImage, scaledToSize newSize:CGSize) -> UIImage{
        UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0)
        image.draw(in: CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height))
        let newImage:UIImage = UIGraphicsGetImageFromCurrentImageContext()!
        UIGraphicsEndImageContext()
        return newImage
    }
}

Related posts

Recent Viewed