Skip to content

Geographical Location Selection Control Imitating Native Map

License

Notifications You must be signed in to change notification settings

0x30/LocationPicker

Repository files navigation

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

200739491@qq.com, 200739491@qq.com

License

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

About

Geographical Location Selection Control Imitating Native Map

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published