MapKitGoogleStyler allows you to include Google Maps JSON styles, that you can create here, and customize your MKMapView to look just like you want (or your client). Including this library is very very easy.
A post explaining this in detail can be found here: https://medium.com/@ortizfernandomartin/customize-mapkits-mkmapview-with-google-maps-styling-wizard-a5dcc095e19f#.ss3dencgh
Using this can't be simpler. The code is self explanatory
//
// ViewController.swift
// MapKitGoogleStylerExample
//
// Created by Fernando Ortiz on 2/6/17.
// Copyright © 2017 Fernando Martín Ortiz. All rights reserved.
//
import UIKit
import MapKit
import MapKitGoogleStyler
classViewController:UIViewController{@IBOutlet weak varmapView:MKMapView!overridefunc viewDidLoad(){
super.viewDidLoad()
mapView.delegate =selfconfigureTileOverlay()}privatefunc configureTileOverlay(){
// We first need to have the path of the overlay configuration JSON
guardlet overlayFileURLString =Bundle.main.path(forResource:"overlay", ofType:"json")else{return}letoverlayFileURL=URL(fileURLWithPath: overlayFileURLString)
// After that, you can create the tile overlay using MapKitGoogleStyler
guardlet tileOverlay =try?MapKitGoogleStyler.buildOverlay(with: overlayFileURL)else{return}
// And finally add it to your MKMapView
mapView.add(tileOverlay)}}extensionViewController:MKMapViewDelegate{func mapView(_ mapView:MKMapView, rendererFor overlay:MKOverlay)->MKOverlayRenderer{
// This is the final step. This code can be copied and pasted into your project
// without thinking on it so much. It simply instantiates a MKTileOverlayRenderer
// for displaying the tile overlay.
iflet tileOverlay = overlay as?MKTileOverlay{returnMKTileOverlayRenderer(tileOverlay: tileOverlay)}else{returnMKOverlayRenderer(overlay: overlay)}}}- Swift 3
- MapKit, of course
MapKitGoogleStyler is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod"MapKitGoogleStyler"fmo91, ortizfernandomartin@gmail.com
MapKitGoogleStyler is available under the MIT license. See the LICENSE file for more info.