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

Get your FREEapp monetisation flowchart!

Use our epic flowchart to help you find the money in your idea! If you're thinking of making an app then this is vital information!


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