Skip to content

Instantly share code, notes, and snippets.

@kiliankoe
Created September 30, 2019 20:10
Show Gist options
  • Save kiliankoe/f43e8d4c320ea78cbb37753c77a20204 to your computer and use it in GitHub Desktop.
Save kiliankoe/f43e8d4c320ea78cbb37753c77a20204 to your computer and use it in GitHub Desktop.
3D MapKit Views
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