I am trying to display two sets GPS Coordinates on a map, one being user’s current location and the other being coordinates input by the user. The code below has been copied from a reliable source but does not work for me. I am doing this in Playgrounds on an iPad where one can turn on permissions. I have turned on Core Location - When In Use. The map displays and has responded to the user inputs although not centered?
Obviously I am doing something wrong and would truely appreciate some advice here.
Another question I have is regarding internet access while using MapKit and CoreLocationUI. If internet is required is there a way of pre-loading before use?
import MapKit
import CoreLocationUI
var lat = -27.907625
var long = 152.680835
struct ContentView: View {
@State private var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: (lat), longitude: (long)), span: MKCoordinateSpan(latitudeDelta: 0.00001, longitudeDelta: 0.00001))
var body: some View {
Map(coordinateRegion: $region, showsUserLocation: true, userTrackingMode: .constant(.follow))
.frame(width: 400, height: 800)
}
}