/SwiftCountryPicker

CountryPicker in Swift that uses Emoji for flags.

Primary LanguageShellMIT LicenseMIT

SwiftCountryPicker

Image

[![CI Status](http://img.shields.io/travis/Samuel Beek/SwiftCountryPicker.svg?style=flat)](https://travis-ci.org/Samuel Beek/SwiftCountryPicker) Version License Platform

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, ik@samuelbeek.com, twitter

License

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