I'm trying to change GMSMarker
icon with Moa
but marker is still showing default icon. This is my code:
override func viewDidLoad() {
super.viewDidLoad()
locationmanager.delegate = self
let authorizationStatus = CLLocationManager.authorizationStatus()
if(authorizationStatus == .authorizedWhenInUse || authorizationStatus == .authorizedAlways) {
locationmanager.startUpdatingLocation()
MapView.isMyLocationEnabled = true
MapView.settings.myLocationButton = true
} else {
locationmanager.requestWhenInUseAuthorization()
}
MapView.camera = GMSCameraPosition.camera(withLatitude: 32.4279, longitude: 53.6880, zoom: 5)
MapView.delegate = self
prepareMapMarkers()
}
func prepareMapMarkers(){
let marker = GMSMarker(position: CLLocationCoordinate2D(latitude: CLLocationDegrees(malls[0].lat), longitude: CLLocationDegrees(malls[0].long)))
marker.map = MapView
moa.onSuccess = { image in
print(image)
marker.icon = image.images?[0]
return image
}
moa.url = "http://www.w3schools.com/css/img_fjords.jpg"
}
console
<UIImage: 0x60000009e050>, {600, 400}
That image is just for test. Why it's not working?
Try this! It worked for me