TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jan 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Samuel Beek.
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)
iOS 9 or higher
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
Samuel Beek, [email protected], twitter
SwiftCountryPicker is available under the MIT license. See the LICENSE file for more info.