Giter Club home page Giter Club logo

countrypicker's Introduction

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

  • Navigate through search and index title of section e.g (in Contact app in iOS)
  • cocoa Pods integrated
  • 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.

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

Demo

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

countrypicker's People

Contributors

ashishkakkad8 avatar d3nzz3l avatar senseiphonex avatar suryafatbit avatar suryakantsharma avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.