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 withdefault
instance 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:
-
shouldAddPlusInCountryCode
used to decide to use the "+" sign in front of country code. Default:true
-
toolbarHeight
used to give the height of tool bar. Default:45.0
-
pickerSize
used to give the size for the picker view. Default:CGSize(width: <same to screen width>, height: 240.0)
-
rowHeight
used to give the height of the each row in picker view. Default:45.0
-
appearance
used to decide the appearance of the picker view. Default:PKCountryPicker.Appearance.light
-
countryNameFont
used to set the font of country name text. Default:UIFont.systemFont(ofSize: 15.0)
-
countryNameColor
used to set the color of country name text. Default:UIColor.black
-
countryCodeFont
used to set the font of country code text. Default:UIFont.systemFont(ofSize: 15.0)
-
countryCodeColor
used to set the color of country code text. Default:UIColor.black
Licence
PKCountryPicker is released under the MIT license.