HLFMapViewController 0.4.0

HLFMapViewController 0.4.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Dec 2016
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Peng Wang.




HLFMapViewController

Code Climate

A generic implementation of a common feature: searching and selecting a nearby location from an MKMapView.

screenshot-1   screenshot-2

Usage

This version uses Swift 3 and Cocoapods 0.1.0+. The final Swift 2 version is 0.2.5.

To run the example project, clone the repo, and run pod install from the Example directory first.

In addition to turning on the ‘Maps’ capability, you’ll need to add location-services to UIRequiredDeviceCapabilitiesand fill in NSLocationAlwaysUsageDescription in your Info.plist.

Other than that just set up the view controller and implement the delegate method:

// ...
let mapViewController = MapViewController(nibName: "MapViewController", bundle: MapViewController.bundle)
mapViewController.delegate = self
mapViewController.selectedMapItem = self.selectedMapItem // Optional.
// ...

func mapViewController(_ mapViewController: MapViewController, didSelectMapItem mapItem: MKMapItem) {
    self.selectedMapItem = mapItem // Save, submit, etc.
    mapViewController.dismissViewController(animated: true, completion: nil)
}

See example app for more details.

Installation

HLFMapViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "HLFMapViewController"

License

HLFMapViewController is available under the MIT license. See the LICENSE file for more info.