Skip to main content

Posts

Showing posts with the label Search Location

iOS MapKit Tutorial: Getting Started Search Location and Directions on Mapkit

MapKit is a really useful API available on iOS devices that makes it easy to display maps, user locations with locality, and even draw routes your location to your destination.
Getting Started User Location
Create a new project single view appplication in Swift. - MKLocationMap


Open Info.plist from the Project navigator and configure the location permission prompt message NSLocationWhenInUseUsageDescription
Add "NSLocationAlwaysAndWhenInUseUsageDescription" instead of "Privacy - Location Always and When in use usage description".


ViewController.swift:
import UIKit import MapKit
protocol HandleMapSearch { func dropPinZoomIn(placemark:MKPlacemark) } class ViewController: UIViewController{ let locationManager = CLLocationManager() var resultSearchController:UISearchController! var selectedPin:MKPlacemark? @IBOutletvar mapView: MKMapView! overridefunc viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. locationManager.delegat…