Skip to content

ThirdParty-Forks/LocationPicker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LocationPicker

LocationPickerViewController is a UIViewController subclass to let users choose locations by searching or selecting on map. It's designed to work as UIImagePickerController.

User can select location either by searching or long pressing on map. In both cases you'll receive CLPlacemark, which contains location coordinates as well as information such as the country, state, city, street address, and POI names.

Installation

Carthage

github "almassapargali/LocationPicker"

Screenshots

Usage

Create a new instance in code (LocationPickerViewController()) or by setting class of UIViewController in Storyboard. Then provide completion block which will be called when user closes view controller.

let locationPicker = LocationPickerViewController()

// you can optionally set initial location
let location = CLLocation(latitude: 35, longitude: 35)
let initialLocation = Location(name: nil, location: location)
locationPicker.location = initialLocation

// optional region distance to be used for creation region when user selects place from search results (defaults to 600)
locationPicker.resultRegionDistance = 500

locationPicker.completion = { location in
    // do some awesome stuff with location
}

navigationController?.pushViewController(locationPicker, animated: true)

Note: LocationPickerViewController is expected to be pushed to UINavigationController. Pull requests for supporting other presentation styles are welcome

License

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

About

iOS location picker view controller

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 97.5%
  • Objective-C 2.5%