CCCountrySelector 2.4

CCCountrySelector 2.4

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Feb 2021
SPMSupports SPM

Maintained by Chad Chang.



  • By
  • Chang Chad

CCCountrySelector

DEMO

Usage

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)
    }

Optional

  • setDefaultCountry() to set an initial country.
  selectView.setDefaultCountry("TW")
  • By passing a string array to setFrequentCountryList() to mark frequently used.
  selectView.setFrequentCountryList(["TW","US"])
  • By passing a string array to setRestrictCountry() to show those countries desired.
  selectView.setRestrictCountry(["TW","US","CA"])
  • By passing a bool value to setFlagHidden() to set flag image hidden or show.
  selectView.setFlagHidden(true)

Installation

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

TODO

Author

Chang Chad, chadchang.tw at gmail.com

License

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

Attributions