This library is for country picker used in many app for selecting country code of user. User can select country by searching and then selecting country cell.
This project use swift 4.0 and xcode 9.0. You can download locally and run the code. You can customize and use according to your need. example:
class ViewController: UIViewController {
//MARK:- IBOutlet
@IBOutlet weak var countryCodeButton: UIButton!
@IBOutlet weak var countryImageView: UIImageView!
let contryPickerController = CountryPickerController()
//MARK:- Func
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let country = CountryManager.currentCountry
countryCodeButton.setTitle(country?.dialingCode(), for: .normal)
countryImageView.image = country?.flag
countryCodeButton.clipsToBounds = true
}
@IBAction func countryCodeButtonClicked(_ sender: UIButton) {
let countryController = CountryPickerController.presentController(on: self) { (country: Country) in
self.countryImageView.image = country.flag
self.countryCodeButton.setTitle(country.dialingCode(), for: .normal)
}
countryController.detailColor = UIColor.red
}
}
Any contribution making project better is welcome.
After running the project by default current country get selected as below.
On clicking on this button country picker open with the option of choose or filter the require country.
After selecting selected country with image will appear on your button.
*Suryakant Sharma(https://github.com/SURYAKANTSHARMA)
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details