Created
September 30, 2019 20:10
-
-
Save kiliankoe/f43e8d4c320ea78cbb37753c77a20204 to your computer and use it in GitHub Desktop.
3D MapKit Views
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct MapView: UIViewRepresentable { | |
var coordinate: CLLocationCoordinate2D | |
func makeUIView(context: Context) -> MKMapView { | |
MKMapView(frame: .zero) | |
} | |
func updateUIView(_ view: MKMapView, context: Context) { | |
let camera = MKMapCamera() | |
camera.centerCoordinate = self.coordinate | |
camera.pitch = 45 | |
camera.altitude = 200 | |
camera.heading = 45 | |
view.camera = camera | |
view.pointOfInterestFilter = .excludingAll | |
view.isUserInteractionEnabled = false | |
view.showsBuildings = true | |
view.mapType = .satelliteFlyover | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment