Awesome Open Source
Awesome Open Source

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.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Swift (95,593
Picker (585
Mapkit (164
Related Projects