GoogleMapsTileOverlay
GoogleMapsTileOverlay copied to clipboard
GoogleMapsTileOverlay lets you customize Apple Maps MKMapView with the Google Maps StylingWizard
GoogleMapsTileOverlay for MapKit
GoogleMapsTileOverlay lets you customize Apple Maps MKMapView with the Google Maps StylingWizard.
Install
Swift Package Manager
Add this line to your depedencies in Package.swift
.package("https://github.com/thepeaklab/GoogleMapsTileOverlay", from: "0.5.0")
Carthage
To install GoogleMapsTileOverlay
with Carthage, setup Carthage for your project as described in the Quick Start.
Then add this line to your Cartfile:
github "thepeaklab/GoogleMapsTileOverlay" ~> 0.4.1
CocoaPods
Install CocoaPods if you haven't already
Add this in your Podfile
for your target:
pod 'GoogleMapsTileOverlay', '~> 0.4.1'
And install with:
pod install
Example
You can customize Apple Maps to match the design of your App or Game:
Example Project
Usage
- Create MapStyle with the Google Maps StylingWizard and save it to a JSON-File
- Add JSON-File to your XCode Project
- In your ViewController:
import GoogleMapsTileOverlay
Add custom overlay to your MKMapView:
guard let jsonURL = Bundle.main.url(forResource: "MapStyle", withExtension: "json") else { return }
let tileOverlay = try? GoogleMapsTileOverlay(jsonURL: jsonURL)
tileOverlay.canReplaceMapContent = true
mapView.addOverlay(tileOverlay, level: .aboveRoads)
Add delegate for your MKMapView:
mapView.delegate = self
extension YourViewController: MKMapViewDelegate {
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if let tileOverlay = overlay as? MKTileOverlay {
return MKTileOverlayRenderer(tileOverlay: tileOverlay)
}
return MKOverlayRenderer(overlay: overlay)
}
}
Known Issues
- Labels in iOS 13 On iOS 13 the labels on the map and the annotations are not visible, even when using the level aboveRoads. This bug is already reported to Apple and will hopefully be solved in future versions of iOS.
Need Help?
Please submit an issue on GitHub.
License
This project is licensed under the terms of the MIT license. See the LICENSE file.