Skip to content

List of all countries in the world (name, code, phone code)

License

Notifications You must be signed in to change notification settings

levantAJ/CountrySource

Repository files navigation

Pod Version Pod Platform Pod License

CountrySource

Provides list of all countries in the world (name, code, phone code) & determine current country.

Requirements

  • iOS 9.0 or later
  • Xcode 11.0 or later

Install

Installation with CocoaPods

pod 'CountrySource', '1.2'

Build Project

At this point your workspace should build without error. If you are having problem, post to the Issue and the community can help you solve it.

How to use:

import CountrySource

Get current country:

CountrySource().currentCountry { result in
    switch result {
    case .success(let country):
        print(country.code, country.name, country.dialCode)
    case .failure(let error):
        print(error)
    }

Get all countries

CountrySource().allCountries { result in
    switch result {
    case .success(let countries):
        print(countries)
    case .failure(let error):
        print(error)            
    }
}

Author

Communication

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Licenses

All source code is licensed under the MIT License.