Latest 0.1.1
Homepage https://github.com/Ar4n3/CountryCallingCodes
License MIT
Platforms ios 10.0
Frameworks UIKit
Authors

Build Status codecov pod license

A simple and easy way to get the international calling code and Emoji flag from a selected Country. Demos are provided in Objective-C and Swift.

Installation

You can download this project, or you can install it via Cocoapods:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'

target 'TargetName' do
pod 'CountryCallingCodes'
end

How to use

Objective-C

Get the default data for your device locale (e.g. flag => :es:, code => "+34")

[[CountryCallingCode sharedInstance] setDelegate:self];
NSString *buttonString = [NSString stringWithFormat:@"%@t%@", [CountryCallingCode sharedInstance].flag, [CountryCallingCode sharedInstance].code];
[_countryButton setTitle:buttonString forState:UIControlStateNormal];

To select another country, make a segue to storyboard reference and on your delegate implement:

#pragma mark - Delegate Methods

- (void)updateCountryData {
    NSString *buttonString = [NSString stringWithFormat:@"%@t%@", [CountryCallingCode sharedInstance].flag, [CountryCallingCode sharedInstance].code];
    [_countryButton setTitle:buttonString forState:UIControlStateNormal];
}

Swift

Get the default data for your device locale (e.g. flag => :es:, code => "+34")

CountryCallingCode.sharedInstance().delegate = self
let buttonString = String.init(format: "%@t%@", CountryCallingCode.sharedInstance().flag, CountryCallingCode.sharedInstance().code)
countryButton.setTitle(buttonString, for: .normal)

To select another country, make a segue to storyboard reference and on your delegate implement:

//MARK: Delegate methods
func updateCountryData() {
   let buttonString = String.init(format: "%@t%@", CountryCallingCode.sharedInstance().flag, CountryCallingCode.sharedInstance().code)
   countryButton.setTitle(buttonString, for: .normal)
}

Latest podspec

{
    "name": "CountryCallingCodes",
    "version": "0.1.1",
    "summary": "A simple to use framework that displays a UI with a list of country names, with their calling codes and Emoji flags and returns that data.",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/Ar4n3/CountryCallingCodes",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Ar4n3": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Ar4n3/CountryCallingCodes.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "CountryCallingCodes/Classes/**/*",
    "resource_bundles": {
        "CountryCallingCodes": [
            "CountryCallingCodes/Assets/*.{storyboard,json,png}"
        ]
    },
    "public_header_files": "CountryCallingCodes/Classes/CountryCallingCode.h",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This