Latest 0.2.0
Homepage https://github.com/chronotruck/CTKFlagPhoneNumber
License Apache License 2.0
Platforms ios 8.0
Dependencies libPhoneNumber-iOS
Authors

CTKFlagPhoneNumber is a phone number textfield with a fancy country code picker.

CI Status
Version
License
Platform
Language

Screenshot

sample

Example

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

Requirements

Installation

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

pod "CTKFlagPhoneNumber"

Usage

You can instance it in storyboards or .xibs.

You can programmatically change the choosen flag:

phoneNumberTextField.setFlag(with: "FR")

and the phone number:

phoneNumberTextField.set(phoneNumber: "0600000001")

This function updates the flag according to the phone number

You can also get the phone number to E164 format:

print(phoneNumberTextField.getPhoneNumber())
// Output: +33600000001

Customization

FlagKit is used by default but you can customize the list with your own flag icons assets:

Bundle.FlagIcons = YOUR_FLAG_ICONS_BUNDLE

Be sure to set it before initializing a CTKFlagPhoneNumber instance.

Conception

This library is high inspired of MRCountryPicker library and use libPhoneNumber-iOS library.
https://github.com/xtrinch/MRCountryPicker / https://github.com/iziz/libPhoneNumber-iOS

Author

grifas, [email protected]

Don’t hesitate to contact me or make a pull request to upgrade this library.

License

CTKFlagPhoneNumber is available under the Apache license. See the LICENSE file for more info.

Latest podspec

{
    "name": "CTKFlagPhoneNumber",
    "version": "0.2.0",
    "summary": "A formatted phone number UITextField with country flag picker.",
    "description": "CTKFlagPhoneNumber is a phone number textfield that allows you to choose the country code thanks to a picker. It uses libPhoneNumber to format the number in the textfield according to country code.",
    "homepage": "https://github.com/chronotruck/CTKFlagPhoneNumber",
    "license": {
        "type": "Apache License 2.0",
        "file": "LICENSE"
    },
    "authors": {
        "Auru00e9lien Grifasi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/chronotruck/CTKFlagPhoneNumber.git",
        "tag": "0.2.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "CTKFlagPhoneNumber/**/*.swift",
    "resource_bundles": {
        "CTKFlagPhoneNumber": [
            "CTKFlagPhoneNumber/Resources/**/*"
        ]
    },
    "dependencies": {
        "libPhoneNumber-iOS": []
    }
}

Pin It on Pinterest

Share This