Skip to content

Provides ISO codes, names and currencies for countries.

Notifications You must be signed in to change notification settings

lorismaz/IsoCountryCodes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

#IsoCountryCodes for Swift Platform [version] (https://github.com/funky-monkey/IsoCountryCodes) ![Swift Version] (https://img.shields.io/badge/swift-3.0-orange.svg?style=flat)

Iso country codes - that thing that we discussed that defines codes for the names of countries, dependent territories, and special areas of geographical interest.

###What? This is a iOS Swift library/class files that does a simple lookup depending on a alpha2, alpha3 or numeric value you give it. Currently it holds all the 249 countries, territories, or areas of geographical interest that are assigned official codes in ISO 3166-1.

###Features:

This library returns ISO codes, names and currencies for countries.

  • Find by alpha-2, alpha-3 or numeric (String - yes I know...)
  • Search by name
  • Search by currency code
  • Search by by dialing code (+31 for Nethelands, +1 for USA, etc...)

###Usage:

Searching an ISO code returns a struct.

// Search via numeric, alpha-2 or alpha-3 format
print(IsoCountryCodes.find(key: "020").name) //Andorra
print(IsoCountryCodes.find(key: "TK").name) //Tokelau
print(IsoCountryCodes.find(key: "TKL").currency) //NZD

// You can also search by country name, currency or calling/dialing code
dump(IsoCountryCodes.searchByName(name: "Netherlands")
print(IsoCountryCodes.searchByCurrency(currency: "EUR").count ) // 31
print(IsoCountryCodes.searchByCallingCode(calllingCode: "+31").name ) // Netherlands

let country = IsoCountryCodes.searchByName(name: "Netherlands")
dump(country) // This dumps the full struct in console

/* 
	▿ IsoCountryCodes.IsoCountryInfo
	- name: Netherlands
	- numeric: 528
	- alpha2: NL
	- alpha3: NLD
	- calling: +31
	- currency: EUR
	- continent: EU
*/

###Usage:

Copy/add files to your project

###Licence:

The 'do-whatever-you-please-with-it licence. Use it or abuse it. Just keep my name at the top of the files.

About

Provides ISO codes, names and currencies for countries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%