Reputation: 337
Is there a way to get current location without calling delegate didUpdateLocations in CLLocationManager using swift 3 or 4?
Upvotes: 0
Views: 533
Reputation: 7451
You can use mapView.userLocation.coordinate
.
https://developer.apple.com/documentation/mapkit/mkmapview/1452459-userlocation
Upvotes: 0
Reputation: 26
You wouldn’t call didUpdateLocation: but rather requestLocation() which would update the user location then call didUpdateLocation, but that’s besides the point...
The “location” instance property might be what you are looking for but as the documentation states, you aren’t guaranteed of it being recent and you should check the time stamp.
https://developer.apple.com/documentation/corelocation/cllocationmanager/1423687-location
Upvotes: 1