This code below pulls up the map view in my iOS app. I want to show the users location with a blue dot like in google maps.
What code do I insert and where to make this happen?
Note: I am looking through the MapKit documentation section of the Apple Developer Documentation website. There is a section called "Displaying the User's Location". I just can't seem to figure out how to integrate the given codes into my code. Such as
Also note, the code I'm using is from an apple developer tutorial https://developer.apple.com/tutorials/swiftui/creating-and-combining-views
section 5 step 4.
What code do I insert and where to make this happen?
Note: I am looking through the MapKit documentation section of the Apple Developer Documentation website. There is a section called "Displaying the User's Location". I just can't seem to figure out how to integrate the given codes into my code. Such as
Code Block var showsUserLocation: Bool { get set }
etc.Also note, the code I'm using is from an apple developer tutorial https://developer.apple.com/tutorials/swiftui/creating-and-combining-views
section 5 step 4.
Code Block import SwiftUI import MapKit import UIKit import CoreLocation struct MapView: UIViewRepresentable { var coordinate: CLLocationCoordinate2D func makeUIView(context: Context) -> MKMapView { MKMapView(frame: .zero) } func updateUIView(_ uiView: MKMapView, context: Context) { let span = MKCoordinateSpan(latitudeDelta: 50, longitudeDelta: 50) let region = MKCoordinateRegion(center: coordinate, span: span) uiView.setRegion(region, animated: true) uiView.mapType = .hybridFlyover } } struct MapView_Previews: PreviewProvider { static var previews: some View { MapView(coordinate: landmarkData[0].locationCoordinate) } }