GoogleMapsTileOverlay lets you customize Apple Maps MKMapView with the Google Maps StylingWizard.
Add this line to your depedencies in Package.swift
.package("https://github.com/thepeaklab/GoogleMapsTileOverlay", from: "0.5.0")
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
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
You can customize Apple Maps to match the design of your App or Game:
import GoogleMapsTileOverlay
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)
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)
}
}
Please submit an issue on GitHub.
This project is licensed under the terms of the MIT license. See the LICENSE file.
link |
Stars: 72 |
Last commit: 3 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics