Last active
February 15, 2024 09:50
-
-
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
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 | |
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