SwiftCountryPicker 1.0.1

SwiftCountryPicker 1.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jan 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Samuel Beek.




  • By
  • Samuel Beek

SwiftCountryPicker

Image

Usage

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

For the most clear example, checkout the example project

Create a new CountryPicker

let countryPicker = CountryPicker(frame: CGRectMake(0,0,self.view.frame.size.width, 216))
countryPicker.countryDelegate = self

To retreive the picked country the ViewController must conform with the CountryPickerDelegate, do that by adding the following snippet at the bottom of your file:

func countryPicker(picker: CountryPicker, didSelectCountry country: Country) {
    // do whatever you want with the picked Counrty
}

To add the CountryPicker as inputView for a textField:

textField = UITextField(frame: CGRectMake(0,0,40,30))
textField.inputView = countryPicker
view.addSubview(textField)

Requirements

iOS 9 or higher

Installation

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

pod "SwiftCountryPicker"

or install it with Carthage

github "samuelbeek/SwiftCountryPicker"

Add the following line to the top of the file you want to use the CountryPicker in:

import SwiftCountryPicker 

Author

Samuel Beek, [email protected], twitter

License

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