Currency
public struct Currency : Equatable, Hashable
A structure representing the basic attributes of a currency.
Represents the English name, ISO 4217 code, and minor unit of a currency.
Most users wont need to construct their own instance of a currency, but instead access one using either:
Currencies.all
Currencies.with(currencyCode:)
Currencies.GBP
, Currencies.USD
, etc.
See also
-
The English name of the currency. e.g. Pound Sterling
Declaration
Swift
public let name: String
-
The ISO 4217 code representing the currency. e.g. GBP
Declaration
Swift
public let code: String
-
The minor unit / exponent for the currency.
USD and GBP would be represented with a
minorUnit
of 2. Illustrated by £3.57 and $4.99 - both currencies deal in 2 decimal places.Declaration
Swift
public let minorUnit: Int16
-
Declaration
Swift
public init(name: String, code: String, minorUnit: Int16)
Parameters
name
The descriptive name of the currency, e.g. US Dollar
code
An alpha identifier for the currency, e.g. USD
minorUnit
The number of decimal places used to represent the minor unit. e.g. for USD, the
minorUnit
would be2
-
Request a currency for a given ISO 4217 currency code.
For example, to obtain the UK Pound:
let GBP = Currency.with(currencyCode: "GBP")
Declaration
Swift
static func with(currencyCode: String) -> Currency?
Parameters
currencyCode
The ISO standard currency code. e.g.
USD
for US DollarsReturn Value
If a currency exists for the given
currencyCode
then a configuredCurrency
will be returned. If no currency exists thennil
will be returned.
-
All standard
Currency
values defined by ISO 4217Declaration
Swift
static let all: [Currency]
-
UAE Dirham (AED) with minor unit 2
Declaration
Swift
static let AED: Currency
-
Afghani (AFN) with minor unit 2
Declaration
Swift
static let AFN: Currency
-
Lek (ALL) with minor unit 2
Declaration
Swift
static let ALL: Currency
-
Armenian Dram (AMD) with minor unit 2
Declaration
Swift
static let AMD: Currency
-
Netherlands Antillean Guilder (ANG) with minor unit 2
Declaration
Swift
static let ANG: Currency
-
Kwanza (AOA) with minor unit 2
Declaration
Swift
static let AOA: Currency
-
Argentine Peso (ARS) with minor unit 2
Declaration
Swift
static let ARS: Currency
-
Australian Dollar (AUD) with minor unit 2
Declaration
Swift
static let AUD: Currency
-
Aruban Florin (AWG) with minor unit 2
Declaration
Swift
static let AWG: Currency
-
Azerbaijan Manat (AZN) with minor unit 2
Declaration
Swift
static let AZN: Currency
-
Convertible Mark (BAM) with minor unit 2
Declaration
Swift
static let BAM: Currency
-
Barbados Dollar (BBD) with minor unit 2
Declaration
Swift
static let BBD: Currency
-
Taka (BDT) with minor unit 2
Declaration
Swift
static let BDT: Currency
-
Bulgarian Lev (BGN) with minor unit 2
Declaration
Swift
static let BGN: Currency
-
Bahraini Dinar (BHD) with minor unit 3
Declaration
Swift
static let BHD: Currency
-
Burundi Franc (BIF) with minor unit 0
Declaration
Swift
static let BIF: Currency
-
Bermudian Dollar (BMD) with minor unit 2
Declaration
Swift
static let BMD: Currency
-
Brunei Dollar (BND) with minor unit 2
Declaration
Swift
static let BND: Currency
-
Boliviano (BOB) with minor unit 2
Declaration
Swift
static let BOB: Currency
-
Brazilian Real (BRL) with minor unit 2
Declaration
Swift
static let BRL: Currency
-
Bahamian Dollar (BSD) with minor unit 2
Declaration
Swift
static let BSD: Currency
-
Ngultrum (BTN) with minor unit 2
Declaration
Swift
static let BTN: Currency
-
Pula (BWP) with minor unit 2
Declaration
Swift
static let BWP: Currency
-
Belarusian Ruble (BYN) with minor unit 2
Declaration
Swift
static let BYN: Currency
-
Belize Dollar (BZD) with minor unit 2
Declaration
Swift
static let BZD: Currency
-
Canadian Dollar (CAD) with minor unit 2
Declaration
Swift
static let CAD: Currency
-
Congolese Franc (CDF) with minor unit 2
Declaration
Swift
static let CDF: Currency
-
Swiss Franc (CHF) with minor unit 2
Declaration
Swift
static let CHF: Currency
-
Chilean Peso (CLP) with minor unit 0
Declaration
Swift
static let CLP: Currency
-
Yuan Renminbi (CNY) with minor unit 2
Declaration
Swift
static let CNY: Currency
-
Colombian Peso (COP) with minor unit 2
Declaration
Swift
static let COP: Currency
-
Costa Rican Colon (CRC) with minor unit 2
Declaration
Swift
static let CRC: Currency
-
Peso Convertible (CUC) with minor unit 2
Declaration
Swift
static let CUC: Currency
-
Cuban Peso (CUP) with minor unit 2
Declaration
Swift
static let CUP: Currency
-
Cabo Verde Escudo (CVE) with minor unit 2
Declaration
Swift
static let CVE: Currency
-
Czech Koruna (CZK) with minor unit 2
Declaration
Swift
static let CZK: Currency
-
Djibouti Franc (DJF) with minor unit 0
Declaration
Swift
static let DJF: Currency
-
Danish Krone (DKK) with minor unit 2
Declaration
Swift
static let DKK: Currency
-
Dominican Peso (DOP) with minor unit 2
Declaration
Swift
static let DOP: Currency
-
Algerian Dinar (DZD) with minor unit 2
Declaration
Swift
static let DZD: Currency
-
Egyptian Pound (EGP) with minor unit 2
Declaration
Swift
static let EGP: Currency
-
Nakfa (ERN) with minor unit 2
Declaration
Swift
static let ERN: Currency
-
Ethiopian Birr (ETB) with minor unit 2
Declaration
Swift
static let ETB: Currency
-
Euro (EUR) with minor unit 2
Declaration
Swift
static let EUR: Currency
-
Fiji Dollar (FJD) with minor unit 2
Declaration
Swift
static let FJD: Currency
-
Pound Sterling (GBP) with minor unit 2
Declaration
Swift
static let GBP: Currency
-
Lari (GEL) with minor unit 2
Declaration
Swift
static let GEL: Currency
-
Ghana Cedi (GHS) with minor unit 2
Declaration
Swift
static let GHS: Currency
-
Gibraltar Pound (GIP) with minor unit 2
Declaration
Swift
static let GIP: Currency
-
Dalasi (GMD) with minor unit 2
Declaration
Swift
static let GMD: Currency
-
Guinean Franc (GNF) with minor unit 0
Declaration
Swift
static let GNF: Currency
-
Quetzal (GTQ) with minor unit 2
Declaration
Swift
static let GTQ: Currency
-
Guyana Dollar (GYD) with minor unit 2
Declaration
Swift
static let GYD: Currency
-
Hong Kong Dollar (HKD) with minor unit 2
Declaration
Swift
static let HKD: Currency
-
Lempira (HNL) with minor unit 2
Declaration
Swift
static let HNL: Currency
-
Kuna (HRK) with minor unit 2
Declaration
Swift
static let HRK: Currency
-
Gourde (HTG) with minor unit 2
Declaration
Swift
static let HTG: Currency
-
Forint (HUF) with minor unit 2
Declaration
Swift
static let HUF: Currency
-
Rupiah (IDR) with minor unit 2
Declaration
Swift
static let IDR: Currency
-
New Israeli Sheqel (ILS) with minor unit 2
Declaration
Swift
static let ILS: Currency
-
Indian Rupee (INR) with minor unit 2
Declaration
Swift
static let INR: Currency
-
Iraqi Dinar (IQD) with minor unit 3
Declaration
Swift
static let IQD: Currency
-
Iranian Rial (IRR) with minor unit 2
Declaration
Swift
static let IRR: Currency
-
Iceland Krona (ISK) with minor unit 0
Declaration
Swift
static let ISK: Currency
-
Jamaican Dollar (JMD) with minor unit 2
Declaration
Swift
static let JMD: Currency
-
Jordanian Dinar (JOD) with minor unit 3
Declaration
Swift
static let JOD: Currency
-
Yen (JPY) with minor unit 0
Declaration
Swift
static let JPY: Currency
-
Kenyan Shilling (KES) with minor unit 2
Declaration
Swift
static let KES: Currency
-
Som (KGS) with minor unit 2
Declaration
Swift
static let KGS: Currency
-
Riel (KHR) with minor unit 2
Declaration
Swift
static let KHR: Currency
-
Comorian Franc (KMF) with minor unit 0
Declaration
Swift
static let KMF: Currency
-
North Korean Won (KPW) with minor unit 2
Declaration
Swift
static let KPW: Currency
-
Won (KRW) with minor unit 0
Declaration
Swift
static let KRW: Currency
-
Kuwaiti Dinar (KWD) with minor unit 3
Declaration
Swift
static let KWD: Currency
-
Cayman Islands Dollar (KYD) with minor unit 2
Declaration
Swift
static let KYD: Currency
-
Tenge (KZT) with minor unit 2
Declaration
Swift
static let KZT: Currency
-
Lao Kip (LAK) with minor unit 2
Declaration
Swift
static let LAK: Currency
-
Lebanese Pound (LBP) with minor unit 2
Declaration
Swift
static let LBP: Currency
-
Sri Lanka Rupee (LKR) with minor unit 2
Declaration
Swift
static let LKR: Currency
-
Liberian Dollar (LRD) with minor unit 2
Declaration
Swift
static let LRD: Currency
-
Loti (LSL) with minor unit 2
Declaration
Swift
static let LSL: Currency
-
Libyan Dinar (LYD) with minor unit 3
Declaration
Swift
static let LYD: Currency
-
Moroccan Dirham (MAD) with minor unit 2
Declaration
Swift
static let MAD: Currency
-
Moldovan Leu (MDL) with minor unit 2
Declaration
Swift
static let MDL: Currency
-
Malagasy Ariary (MGA) with minor unit 2
Declaration
Swift
static let MGA: Currency
-
Denar (MKD) with minor unit 2
Declaration
Swift
static let MKD: Currency
-
Kyat (MMK) with minor unit 2
Declaration
Swift
static let MMK: Currency
-
Tugrik (MNT) with minor unit 2
Declaration
Swift
static let MNT: Currency
-
Pataca (MOP) with minor unit 2
Declaration
Swift
static let MOP: Currency
-
Ouguiya (MRO) with minor unit 2
Declaration
Swift
static let MRO: Currency
-
Mauritius Rupee (MUR) with minor unit 2
Declaration
Swift
static let MUR: Currency
-
Rufiyaa (MVR) with minor unit 2
Declaration
Swift
static let MVR: Currency
-
Malawi Kwacha (MWK) with minor unit 2
Declaration
Swift
static let MWK: Currency
-
Mexican Peso (MXN) with minor unit 2
Declaration
Swift
static let MXN: Currency
-
Malaysian Ringgit (MYR) with minor unit 2
Declaration
Swift
static let MYR: Currency
-
Mozambique Metical (MZN) with minor unit 2
Declaration
Swift
static let MZN: Currency
-
Namibia Dollar (NAD) with minor unit 2
Declaration
Swift
static let NAD: Currency
-
Naira (NGN) with minor unit 2
Declaration
Swift
static let NGN: Currency
-
Cordoba Oro (NIO) with minor unit 2
Declaration
Swift
static let NIO: Currency
-
Norwegian Krone (NOK) with minor unit 2
Declaration
Swift
static let NOK: Currency
-
Nepalese Rupee (NPR) with minor unit 2
Declaration
Swift
static let NPR: Currency
-
New Zealand Dollar (NZD) with minor unit 2
Declaration
Swift
static let NZD: Currency
-
Rial Omani (OMR) with minor unit 3
Declaration
Swift
static let OMR: Currency
-
Balboa (PAB) with minor unit 2
Declaration
Swift
static let PAB: Currency
-
Sol (PEN) with minor unit 2
Declaration
Swift
static let PEN: Currency
-
Kina (PGK) with minor unit 2
Declaration
Swift
static let PGK: Currency
-
Philippine Piso (PHP) with minor unit 2
Declaration
Swift
static let PHP: Currency
-
Pakistan Rupee (PKR) with minor unit 2
Declaration
Swift
static let PKR: Currency
-
Zloty (PLN) with minor unit 2
Declaration
Swift
static let PLN: Currency
-
Guarani (PYG) with minor unit 0
Declaration
Swift
static let PYG: Currency
-
Qatari Rial (QAR) with minor unit 2
Declaration
Swift
static let QAR: Currency
-
Romanian Leu (RON) with minor unit 2
Declaration
Swift
static let RON: Currency
-
Serbian Dinar (RSD) with minor unit 2
Declaration
Swift
static let RSD: Currency
-
Russian Ruble (RUB) with minor unit 2
Declaration
Swift
static let RUB: Currency
-
Rwanda Franc (RWF) with minor unit 0
Declaration
Swift
static let RWF: Currency
-
Saudi Riyal (SAR) with minor unit 2
Declaration
Swift
static let SAR: Currency
-
Solomon Islands Dollar (SBD) with minor unit 2
Declaration
Swift
static let SBD: Currency
-
Seychelles Rupee (SCR) with minor unit 2
Declaration
Swift
static let SCR: Currency
-
Sudanese Pound (SDG) with minor unit 2
Declaration
Swift
static let SDG: Currency
-
Swedish Krona (SEK) with minor unit 2
Declaration
Swift
static let SEK: Currency
-
Singapore Dollar (SGD) with minor unit 2
Declaration
Swift
static let SGD: Currency
-
Saint Helena Pound (SHP) with minor unit 2
Declaration
Swift
static let SHP: Currency
-
Leone (SLL) with minor unit 2
Declaration
Swift
static let SLL: Currency
-
Somali Shilling (SOS) with minor unit 2
Declaration
Swift
static let SOS: Currency
-
Surinam Dollar (SRD) with minor unit 2
Declaration
Swift
static let SRD: Currency
-
South Sudanese Pound (SSP) with minor unit 2
Declaration
Swift
static let SSP: Currency
-
Dobra (STD) with minor unit 2
Declaration
Swift
static let STD: Currency
-
El Salvador Colon (SVC) with minor unit 2
Declaration
Swift
static let SVC: Currency
-
Syrian Pound (SYP) with minor unit 2
Declaration
Swift
static let SYP: Currency
-
Lilangeni (SZL) with minor unit 2
Declaration
Swift
static let SZL: Currency
-
Baht (THB) with minor unit 2
Declaration
Swift
static let THB: Currency
-
Somoni (TJS) with minor unit 2
Declaration
Swift
static let TJS: Currency
-
Turkmenistan New Manat (TMT) with minor unit 2
Declaration
Swift
static let TMT: Currency
-
Tunisian Dinar (TND) with minor unit 3
Declaration
Swift
static let TND: Currency
-
Pa’anga (TOP) with minor unit 2
Declaration
Swift
static let TOP: Currency
-
Turkish Lira (TRY) with minor unit 2
Declaration
Swift
static let TRY: Currency
-
Trinidad and Tobago Dollar (TTD) with minor unit 2
Declaration
Swift
static let TTD: Currency
-
Tanzanian Shilling (TZS) with minor unit 2
Declaration
Swift
static let TZS: Currency
-
Hryvnia (UAH) with minor unit 2
Declaration
Swift
static let UAH: Currency
-
Uganda Shilling (UGX) with minor unit 0
Declaration
Swift
static let UGX: Currency
-
US Dollar (USD) with minor unit 2
Declaration
Swift
static let USD: Currency
-
Peso Uruguayo (UYU) with minor unit 2
Declaration
Swift
static let UYU: Currency
-
Uzbekistan Sum (UZS) with minor unit 2
Declaration
Swift
static let UZS: Currency
-
Bolívar (VEF) with minor unit 2
Declaration
Swift
static let VEF: Currency
-
Dong (VND) with minor unit 0
Declaration
Swift
static let VND: Currency
-
Vatu (VUV) with minor unit 0
Declaration
Swift
static let VUV: Currency
-
Tala (WST) with minor unit 2
Declaration
Swift
static let WST: Currency
-
CFA Franc BEAC (XAF) with minor unit 0
Declaration
Swift
static let XAF: Currency
-
East Caribbean Dollar (XCD) with minor unit 2
Declaration
Swift
static let XCD: Currency
-
CFA Franc BCEAO (XOF) with minor unit 0
Declaration
Swift
static let XOF: Currency
-
CFP Franc (XPF) with minor unit 0
Declaration
Swift
static let XPF: Currency
-
Yemeni Rial (YER) with minor unit 2
Declaration
Swift
static let YER: Currency
-
Rand (ZAR) with minor unit 2
Declaration
Swift
static let ZAR: Currency
-
Zambian Kwacha (ZMW) with minor unit 2
Declaration
Swift
static let ZMW: Currency
-
Zimbabwe Dollar (ZWL) with minor unit 2
Declaration
Swift
static let ZWL: Currency