PKCountryPicker
A Swift based helper class that will provide all the countries in the word with their basic information like flag, county name, country code, ISO code, NSN limits and much more.
Requirements
- iOS 10.0+
- Xcode 9.4
Installation
For manual instalation, drag Source folder into your project.
or use CocoaPod adding this line to you Podfile:
pod 'PKCountryPicker'Usage
For Start Loading
- Just call
chooseCountry()method withdefaultinstance ofPKCountryPicker.
Example:
PKCountryPicker.default.chooseCountry(onViewController: self) { (selectedCountry) in
print("selected country data: \(selectedCountry)")
}Configuration To Change Settings
To change the default configuration of the picker just change the values of PKCountryPickerSettings, Like:
Important Property:
-
shouldAddPlusInCountryCodeused to decide to use the "+" sign in front of country code. Default:true -
toolbarHeightused to give the height of tool bar. Default:45.0 -
pickerSizeused to give the size for the picker view. Default:CGSize(width: <same to screen width>, height: 240.0) -
rowHeightused to give the height of the each row in picker view. Default:45.0 -
appearanceused to decide the appearance of the picker view. Default:PKCountryPicker.Appearance.light -
countryNameFontused to set the font of country name text. Default:UIFont.systemFont(ofSize: 15.0) -
countryNameColorused to set the color of country name text. Default:UIColor.black -
countryCodeFontused to set the font of country code text. Default:UIFont.systemFont(ofSize: 15.0) -
countryCodeColorused to set the color of country code text. Default:UIColor.black
Licence
PKCountryPicker is released under the MIT license.

