Skip to content

A simple, customizable Country picker for picking country or dialing code. ๐Ÿ‡ฎ๐Ÿ‡ณ ๐Ÿ‡ฏ๐Ÿ‡ต ๐Ÿ‡ฐ๐Ÿ‡ท ๐Ÿ‡ฉ๐Ÿ‡ช ๐Ÿ‡จ๐Ÿ‡ณ ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ซ๐Ÿ‡ท ๐Ÿ‡ช๐Ÿ‡ธ ๐Ÿ‡ฎ๐Ÿ‡น ๐Ÿ‡ท๐Ÿ‡บ ๐Ÿ‡ฌ๐Ÿ‡ง

License

SURYAKANTSHARMA/CountryPicker

Repository files navigation

CountryPicker

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.

Getting Started

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

Contributing

Any contribution making project better is welcome.

ScreenShots

countrypickerdemo

After running the project by default current country get selected as below.

defaultopenimage

On clicking on this button country picker open with the option of choose or filter the require country. step2image

After selecting selected country with image will appear on your button. simulator screen shot - iphone 5s - 2017-10-29 at 17 32 52 simulator screen shot - iphone 5s - 2017-10-29 at 17 32 56

Authors

*Suryakant Sharma(https://github.com/SURYAKANTSHARMA)

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

About

A simple, customizable Country picker for picking country or dialing code. ๐Ÿ‡ฎ๐Ÿ‡ณ ๐Ÿ‡ฏ๐Ÿ‡ต ๐Ÿ‡ฐ๐Ÿ‡ท ๐Ÿ‡ฉ๐Ÿ‡ช ๐Ÿ‡จ๐Ÿ‡ณ ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ซ๐Ÿ‡ท ๐Ÿ‡ช๐Ÿ‡ธ ๐Ÿ‡ฎ๐Ÿ‡น ๐Ÿ‡ท๐Ÿ‡บ ๐Ÿ‡ฌ๐Ÿ‡ง

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published