Skip to content

Instantly share code, notes, and snippets.

@cchana
Last active February 15, 2024 09:50
Show Gist options
  • Save cchana/d332becd3877c7d4438cf80df036d599 to your computer and use it in GitHub Desktop.
Save cchana/d332becd3877c7d4438cf80df036d599 to your computer and use it in GitHub Desktop.
A very basic example on how to put an Apple Map element into a SwiftUI View
import SwiftUI
import MapKit
struct ContentView: View {
@State var coordinateRegion: MKCoordinateRegion = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 37.334900, longitude: -122.009020), latitudinalMeters: 1000, longitudinalMeters: 1000)
var body: some View {
Map(coordinateRegion: $coordinateRegion)
.frame(height: 200)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment