Wednesday, November 30, 2016

Building iOS Map Applications in Swift 3

Building iOS Map Applications in Swift 3
When using Mapkit in Xcode, all we need is to do configurations in the following steps:

1. Enable Maps capability

project > capabilities > Maps > on

2. Adding import libraries

Add these two lines in ViewController.swift
import CoreLocation
import MapKit

3. Adding keys in info.plist

NSLocationWhenInUseUsageDescription : 需要時取得使⽤用者位置
NSLocationAlwaysUsageDescription : 不斷的取得位置

4. Create a Location.gpx if using simulator and customizing default location


Setting the default location:
product > scheme > edit scheme
scheme