The iOS map view is incredibly easy to implement and use.  Let’s discover how to show our location with Apples own maps embedded into an iOS and Swift app.

How to Use an iOS Map View

1. Drop an MKMapView into the view on your storyboard:

Map View inside of a View Controller

2. Select the Map View and over in properties make sure that ‘User Location’ option is selected.

Options for displaying location in Apple Maps

3. Inside of the associated View Controller class, make the class inherit from CLLocationManagerDelegate

4. Create a class level variable to hold the Location Manager:

5. In the ViewDidLoad method use the following code to ask for permission for location services:

Now run your iOS map app and your location should be displayed once it asks for your permission!

Showing Location with an iOS Map View and Swift
Tagged on:                 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share This

Exhausted by your 9 - 5?

Would you prefer to work for half the time and earn double? The first step to your freedom is understanding how apps make money. Simply enter your email below and I will send you a free PDF describing the process.

If you're serious about improving your life then do not miss this opportunity.

You have subscribed! Please check your email to confirm this subscription and to receive your item!