Coder Social home page Coder Social logo

alexviquez / mrcountrypicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xtrinch/mrcountrypicker

0.0 2.0 0.0 337 KB

iOS Country picker with flags and optionally phone numbers written in Swift. Swift 3 compatible.

Home Page: https://cocoapods.org/pods/MRCountryPicker

License: MIT License

Swift 100.00%

mrcountrypicker's Introduction

MRCountryPicker

CI Status Version License Platform Carthage compatible

Versions below 0.0.4 are Swift 2.2 compatible, Version 0.0.5+ is Swift 3 compatible.

Example

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

screen shot 2016-06-11 at 13 00 05

Usage

Make your UIPickerView a class of MRCountryPicker, set its countryPickerDelegate and implement its countryPhoneCodePicker method.

See the following example:

class ViewController: UIViewController, MRCountryPickerDelegate {

    @IBOutlet weak var countryPicker: MRCountryPicker!
    @IBOutlet weak var countryName: UILabel!
    @IBOutlet weak var countryCode: UILabel!
    @IBOutlet weak var countryFlag: UIImageView!
    @IBOutlet weak var phoneCode: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        countryPicker.countryPickerDelegate = self
        countryPicker.showPhoneNumbers = true
        countryPicker.setCountry("SI")
    }
    
    // a picker item was selected
    func countryPhoneCodePicker(picker: MRCountryPicker, didSelectCountryWithName name: String, countryCode: String, phoneCode: String, flag: UIImage) {
        self.countryName.text = name
        self.countryCode.text = countryCode
        self.phoneCode.text = phoneCode
        self.countryFlag.image = flag
    }

}

Installation

MRCountryPicker is available through Cocoapods and Carthage.

Add the following line to your Podfile:

pod 'MRCountryPicker', '~> 0.0.6'

Add the following line to your Cartfile:

github "xTrinch/MRCountryPicker" ~> 0.0.6

Author

xtrinch, [email protected]

Made with a little help from my friends over at:
https://github.com/marmelroy/PhoneNumberKit
https://github.com/Keyflow/CountryPicker-iOS-Swift
https://github.com/nicklockwood/CountryPicker

License

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

mrcountrypicker's People

Contributors

xtrinch avatar tedgonzalez avatar 4ndrey avatar deanrock avatar jbbichon avatar

Watchers

James Cloos avatar Alex Viquez 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.