Latest 1.1.7
Homepage https://github.com/SURYAKANTSHARMA/CountryPicker
License MIT
Platforms ios 10.0
Authors

Version
License
my_tweet 1

CountryPicker

A simple, customizable Country picker for picking country or dialing code.
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 in list.

If you like CountryPicker, give it a ★ at the top right of this page.

Features

  • [x] Navigate through search and index title of section e.g (in Contact app in iOS)
  • [x] cocoa Pods integrated
  • [x] Best practices followed

Requirements

  • iOS 10.0+
  • Xcode 9+

    Example

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

    Installation

CountryPicker is available through Cocoapods.

CocoaPods:

Add the following line to your Podfile:

pod 'SKCountryPicker'

current version compatible with Swift 4.1 as well Swift 3.3

Getting Started

Example:

import UIKit
import SKCountryPicker
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.shared.currentCountry
    countryCodeButton.setTitle(country?.dialingCode, for: .normal)
    countryImageView.image = country?.flag
    countryCodeButton.clipsToBounds = true

  }

  @IBAction func countryCodeButtonClicked(_ sender: UIButton) {

    let countryController = CountryPickerWithSectionViewController.presentController(on: self) { (country: Country) in
      self.countryImageView.image = country.flag
      self.countryCodeButton.setTitle(country.dialingCode, for: .normal)

    }
    // can customize the countryPicker here e.g font and color
    countryController.detailColor = UIColor.red
   }
}

Contributing

Any contribution making project better is welcome.

ScreenShots

In Example Project

SKCountryPicker

Demo

SKCountryPicker

Above is a Gif demo.

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

See also the list of contributors who participated in this project. Thanks from bottom of my heart to inspiration behind Hardeep Singh

License

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

Latest podspec

{
    "name": "SKCountryPicker",
    "version": "1.1.7",
    "summary": "A simple, customizable Country picker for picking country or dialing code.",
    "description": "CountryPicker is module for selecting country of the user by searching",
    "homepage": "https://github.com/SURYAKANTSHARMA/CountryPicker",
    "screenshots": [
        "https://user-images.githubusercontent.com/6416095/32143344-40f55c80-bc65-11e7-98d7-5429654940a2.png",
        "https://user-images.githubusercontent.com/6416095/32143470-debef3f8-bc66-11e7-8460-502e5cff1491.png"
    ],
    "license": "MIT",
    "authors": {
        "SuryaKant Sharma": "[email protected]"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/SURYAKANTSHARMA/CountryPicker",
        "tag": "1.1.6"
    },
    "source_files": "CountryPicker/CountryPicker/**/*.{swift}",
    "exclude_files": "Classes/Exclude",
    "resources": "CountryPicker/CountryPicker/*.{png}",
    "resource_bundles": {
        "CountryPickerController": [
            "CountryPicker/CountryPicker/CountryPickerController.bundle/*"
        ]
    }
}

Pin It on Pinterest

Share This