TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Feb 2021 |
SPMSupports SPM | ✗ |
Maintained by Chad Chang.
Add the CCountrySeelctorView to your View, then follow CountrySelectorViewDelegate
protocol
showPickInView()
return a view where UIPickerView placed func showPickInView()->UIView {
return self.view
}
phoneCodeDidChange()
will receive a phone code where user select a country. func phoneCodeDidChange(phoneCode: String) {
print(phoneCode)
}
customPickerView(countryData: CountryData)
retrun a picker view func customPickerView(countryData: CountryData) -> UIView {
return DefaulCountryPickView.init(countryData: countryData)
// use custom view if needed
// return CustomCountryPickerView.init(countryData: countryData)
}
setDefaultCountry()
to set an initial country. selectView.setDefaultCountry("TW")
setFrequentCountryList()
to mark frequently used. selectView.setFrequentCountryList(["TW","US"])
setRestrictCountry()
to show those countries desired. selectView.setRestrictCountry(["TW","US","CA"])
setFlagHidden()
to set flag image hidden or show. selectView.setFlagHidden(true)
CCCountrySelector is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "CCCountrySelector" , '~> 1.5' // Swift 2.3
pod "CCCountrySelector" , '~> 2.0' // Swift 3.0
Chang Chad, chadchang.tw at gmail.com
CCCountrySelector is available under the MIT license. See the LICENSE file for more info.