How to get current user location title to display

My question is how do you get ahold of the current user location title when clicking a button so that it can display the title inside the search bar. I know that by calling locationManager.requestLocation() inside my button it will redirect the user to current location but that is all know how to do. I've tried calling locationManager.location?.description but i had no luck.

Replies

I assume that you want to show the location's coordinates as a place name: if so, you need to use CoreLocation's CLGeocoder class, which returns an array of Placemarks. i.e. name and address. Usually there will be only one place mark for a CLLocation (i.e. coordinates), but sometimes there can be several, e.g. when a location has a number of businesses.

There are plenty of examples on the Web of how to use CLGeocoder, but if you get stuck I can provide some sample code.

Best wishes and regards, Michaela

  • I think you click on the side bar or title bar, you will see the location of that user, when you click on the location icon, you can see the location on google.

Add a Comment