Skip to content

Latest commit

 

History

History
87 lines (52 loc) · 1.99 KB

README.md

File metadata and controls

87 lines (52 loc) · 1.99 KB

LocationPicker

CI Status Version License Platform

Example

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

Requirements

s.swift_version = '5.0'
s.ios.deployment_target = '9.0'

Installation

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

pod 'LocationPicker', :git => 'https://github.com/0x30/LocationPicker'

Use

import CoreLocation
import LocationPicker

class ViewController: UIViewController {

    @IBOutlet weak var descLabel: UILabel!
    
    @IBAction func selectLocation(){
        
        let viewController = LocationPickerViewController()
        
        viewController.pickerDelegate = self
        
        self.present(viewController, animated: true, completion: nil)
    }
}

extension ViewController: LocationPickerViewControllerDelegate{
    
    func userDidCancel() {
        
        self.dismiss(animated: true, completion: nil)
    }
    
    func userSelectLocation(placemark: CLPlacemark) {
        
        self.dismiss(animated: true, completion: nil)
        
        descLabel.text = placemark.formatString
    }
}

preview




Author

[email protected], [email protected]

License

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