ALCountryPicker 1.0.4

ALCountryPicker 1.0.4

Maintained by Abdul.



  • By
  • Abdul

ALCountryPicker

CI Status Version License Platform

Country Picker

List of all countries with flag and dialling code. You serach country by name, region code and dialling code. You can get you current country without opening country picker. For flag Emoji Unicode.Scalar is used.

Requirements

  • iOS 10.0+
  • Xcode 9+
  • Swift 4+

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

ALCountryPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ALCountryPicker'

Getting Started

import UIKit
import ALCountryPicker

class ViewController: UIViewController {

    @IBOutlet weak var countryLabel: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        if let currentCountry = Country.current {
            self.countryLabel.text = currentCountry.flag + " " + currentCountry.countryName +  " (\(String(describing: currentCountry.dialingCode ?? "")))"
        }
        
    }

    @IBAction func openCountry(_ sender: UIButton) {
        CountryPicker.present(on: self) { (country) in
            DispatchQueue.main.async {
                print(country.dialingCode ?? "")
                print(country.flag, "",country.countryName, "", country.countryCode)
                self.countryLabel.text = country.flag + " " + country.countryName +  " (\(String(describing: country.dialingCode ?? "")))"
            }
        }
    }
    
}

Gif

countrypicker

ScreenShots

img1 img2

You can search country by Dialling Code, Region Code and Country Name.

img4 img5 img3

Author

Abdul Shamim Khan [email protected]

License

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