How to do it...

To help display the current location, perform the following steps:

  1. Create a new Xcode project with the Single View Application template and with name the LocationServicesDemo.
  2. In the view controller in storyboard, embed the view controller in Navigation Controller. Then, drag a navigation item from Object Library.
  3. Add a UIBarButtonItem at the top right of the navigation item with the title Locate Me.
  4. Now, add a map view that will be responsible for displaying maps. Drag a MKMapView from Object Library and place it to fill the screen, like this:
  1. Now we need to ask for permission to access the user's location (if we don't ...

Get iOS Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.