How to enable black mode in Google Maps in iOS

Issue #246 Use GMSMapStyle https://developers.google.com/maps/documentation/android-sdk/styling Export styling json from https://mapstyle.withgoogle.com/ let mapStyleUrl = Bundle.main.url(forResource: "mapStyle", withExtension: "json")! mapView.mapStyle = try? GMSMapStyle(contentsOfFileURL: mapStyleUrl) To change overall color, search for mostly "elementType": "geometry" and "featureType": "water" { "elementType": "geometry", "stylers": [ { "color": "#424242" } ] } { "featureType": "water", "elementType": "geometry", "stylers": [ { "color": "#2E2E2E" } ] } ...

May 20, 2019 路 1 min 路 Khoa Pham

How to zoom in double in MapKit

Issue #183 func zoomInDouble(coordinate: CLLocationCoordinate2D) { let region = mapView.region let zoomInRegion = MKCoordinateRegion( center: coordinate, span: MKCoordinateSpan( latitudeDelta: region.span.latitudeDelta * 0.5, longitudeDelta: region.span.longitudeDelta * 0.5 ) ) mapView.setRegion(zoomInRegion, animated: true) } ...

March 22, 2019 路 1 min 路 Khoa Pham

How to select cluster annotation in MapKit

Issue #182 func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) { guard let coordinate = view.annotation?.coordinate else { return } if (view.annotation is MKClusterAnnotation) { zoomInDouble(coordinate: coordinate) } } ...

March 22, 2019 路 1 min 路 Khoa Pham

How to cluster annotations in MapKit in iOS 11

Issue #181 https://developer.apple.com/documentation/mapkit/mkannotationview/decluttering_a_map_with_mapkit_annotation_clustering final class AnnotationView: MKMarkerAnnotationView { override init(annotation: MKAnnotation?, reuseIdentifier: String?) { super.init(annotation: annotation, reuseIdentifier: reuseIdentifier) clusteringIdentifier = String(describing: ClusterView.self) } required init?(coder aDecoder: NSCoder) { fatalError() } } final class ClusterView: MKAnnotationView { override init(annotation: MKAnnotation?, reuseIdentifier: String?) { super.init(annotation: annotation, reuseIdentifier: reuseIdentifier) displayPriority = .defaultHigh } required init?(coder aDecoder: NSCoder) { fatalError() } override func prepareForDisplay() { super.prepareForDisplay() guard let annotation = annotation as? MKClusterAnnotation else { return } let count = annotation....

March 22, 2019 路 1 min 路 Khoa Pham