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.

    • 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 be 2

    • 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 Dollars

      Return Value

      If a currency exists for the given currencyCode then a configured Currency will be returned. If no currency exists then nil will be returned.

    • all

      All standard Currency values defined by ISO 4217

      Declaration

      Swift

      static let all: [Currency]
    • AED

      UAE Dirham (AED) with minor unit 2

      Declaration

      Swift

      static let AED: Currency
    • AFN

      Afghani (AFN) with minor unit 2

      Declaration

      Swift

      static let AFN: Currency
    • ALL

      Lek (ALL) with minor unit 2

      Declaration

      Swift

      static let ALL: Currency
    • AMD

      Armenian Dram (AMD) with minor unit 2

      Declaration

      Swift

      static let AMD: Currency
    • ANG

      Netherlands Antillean Guilder (ANG) with minor unit 2

      Declaration

      Swift

      static let ANG: Currency
    • AOA

      Kwanza (AOA) with minor unit 2

      Declaration

      Swift

      static let AOA: Currency
    • ARS

      Argentine Peso (ARS) with minor unit 2

      Declaration

      Swift

      static let ARS: Currency
    • AUD

      Australian Dollar (AUD) with minor unit 2

      Declaration

      Swift

      static let AUD: Currency
    • AWG

      Aruban Florin (AWG) with minor unit 2

      Declaration

      Swift

      static let AWG: Currency
    • AZN

      Azerbaijan Manat (AZN) with minor unit 2

      Declaration

      Swift

      static let AZN: Currency
    • BAM

      Convertible Mark (BAM) with minor unit 2

      Declaration

      Swift

      static let BAM: Currency
    • BBD

      Barbados Dollar (BBD) with minor unit 2

      Declaration

      Swift

      static let BBD: Currency
    • BDT

      Taka (BDT) with minor unit 2

      Declaration

      Swift

      static let BDT: Currency
    • BGN

      Bulgarian Lev (BGN) with minor unit 2

      Declaration

      Swift

      static let BGN: Currency
    • BHD

      Bahraini Dinar (BHD) with minor unit 3

      Declaration

      Swift

      static let BHD: Currency
    • BIF

      Burundi Franc (BIF) with minor unit 0

      Declaration

      Swift

      static let BIF: Currency
    • BMD

      Bermudian Dollar (BMD) with minor unit 2

      Declaration

      Swift

      static let BMD: Currency
    • BND

      Brunei Dollar (BND) with minor unit 2

      Declaration

      Swift

      static let BND: Currency
    • BOB

      Boliviano (BOB) with minor unit 2

      Declaration

      Swift

      static let BOB: Currency
    • BRL

      Brazilian Real (BRL) with minor unit 2

      Declaration

      Swift

      static let BRL: Currency
    • BSD

      Bahamian Dollar (BSD) with minor unit 2

      Declaration

      Swift

      static let BSD: Currency
    • BTN

      Ngultrum (BTN) with minor unit 2

      Declaration

      Swift

      static let BTN: Currency
    • BWP

      Pula (BWP) with minor unit 2

      Declaration

      Swift

      static let BWP: Currency
    • BYN

      Belarusian Ruble (BYN) with minor unit 2

      Declaration

      Swift

      static let BYN: Currency
    • BZD

      Belize Dollar (BZD) with minor unit 2

      Declaration

      Swift

      static let BZD: Currency
    • CAD

      Canadian Dollar (CAD) with minor unit 2

      Declaration

      Swift

      static let CAD: Currency
    • CDF

      Congolese Franc (CDF) with minor unit 2

      Declaration

      Swift

      static let CDF: Currency
    • CHF

      Swiss Franc (CHF) with minor unit 2

      Declaration

      Swift

      static let CHF: Currency
    • CLP

      Chilean Peso (CLP) with minor unit 0

      Declaration

      Swift

      static let CLP: Currency
    • CNY

      Yuan Renminbi (CNY) with minor unit 2

      Declaration

      Swift

      static let CNY: Currency
    • COP

      Colombian Peso (COP) with minor unit 2

      Declaration

      Swift

      static let COP: Currency
    • CRC

      Costa Rican Colon (CRC) with minor unit 2

      Declaration

      Swift

      static let CRC: Currency
    • CUC

      Peso Convertible (CUC) with minor unit 2

      Declaration

      Swift

      static let CUC: Currency
    • CUP

      Cuban Peso (CUP) with minor unit 2

      Declaration

      Swift

      static let CUP: Currency
    • CVE

      Cabo Verde Escudo (CVE) with minor unit 2

      Declaration

      Swift

      static let CVE: Currency
    • CZK

      Czech Koruna (CZK) with minor unit 2

      Declaration

      Swift

      static let CZK: Currency
    • DJF

      Djibouti Franc (DJF) with minor unit 0

      Declaration

      Swift

      static let DJF: Currency
    • DKK

      Danish Krone (DKK) with minor unit 2

      Declaration

      Swift

      static let DKK: Currency
    • DOP

      Dominican Peso (DOP) with minor unit 2

      Declaration

      Swift

      static let DOP: Currency
    • DZD

      Algerian Dinar (DZD) with minor unit 2

      Declaration

      Swift

      static let DZD: Currency
    • EGP

      Egyptian Pound (EGP) with minor unit 2

      Declaration

      Swift

      static let EGP: Currency
    • ERN

      Nakfa (ERN) with minor unit 2

      Declaration

      Swift

      static let ERN: Currency
    • ETB

      Ethiopian Birr (ETB) with minor unit 2

      Declaration

      Swift

      static let ETB: Currency
    • EUR

      Euro (EUR) with minor unit 2

      Declaration

      Swift

      static let EUR: Currency
    • FJD

      Fiji Dollar (FJD) with minor unit 2

      Declaration

      Swift

      static let FJD: Currency
    • GBP

      Pound Sterling (GBP) with minor unit 2

      Declaration

      Swift

      static let GBP: Currency
    • GEL

      Lari (GEL) with minor unit 2

      Declaration

      Swift

      static let GEL: Currency
    • GHS

      Ghana Cedi (GHS) with minor unit 2

      Declaration

      Swift

      static let GHS: Currency
    • GIP

      Gibraltar Pound (GIP) with minor unit 2

      Declaration

      Swift

      static let GIP: Currency
    • GMD

      Dalasi (GMD) with minor unit 2

      Declaration

      Swift

      static let GMD: Currency
    • GNF

      Guinean Franc (GNF) with minor unit 0

      Declaration

      Swift

      static let GNF: Currency
    • GTQ

      Quetzal (GTQ) with minor unit 2

      Declaration

      Swift

      static let GTQ: Currency
    • GYD

      Guyana Dollar (GYD) with minor unit 2

      Declaration

      Swift

      static let GYD: Currency
    • HKD

      Hong Kong Dollar (HKD) with minor unit 2

      Declaration

      Swift

      static let HKD: Currency
    • HNL

      Lempira (HNL) with minor unit 2

      Declaration

      Swift

      static let HNL: Currency
    • HRK

      Kuna (HRK) with minor unit 2

      Declaration

      Swift

      static let HRK: Currency
    • HTG

      Gourde (HTG) with minor unit 2

      Declaration

      Swift

      static let HTG: Currency
    • HUF

      Forint (HUF) with minor unit 2

      Declaration

      Swift

      static let HUF: Currency
    • IDR

      Rupiah (IDR) with minor unit 2

      Declaration

      Swift

      static let IDR: Currency
    • ILS

      New Israeli Sheqel (ILS) with minor unit 2

      Declaration

      Swift

      static let ILS: Currency
    • INR

      Indian Rupee (INR) with minor unit 2

      Declaration

      Swift

      static let INR: Currency
    • IQD

      Iraqi Dinar (IQD) with minor unit 3

      Declaration

      Swift

      static let IQD: Currency
    • IRR

      Iranian Rial (IRR) with minor unit 2

      Declaration

      Swift

      static let IRR: Currency
    • ISK

      Iceland Krona (ISK) with minor unit 0

      Declaration

      Swift

      static let ISK: Currency
    • JMD

      Jamaican Dollar (JMD) with minor unit 2

      Declaration

      Swift

      static let JMD: Currency
    • JOD

      Jordanian Dinar (JOD) with minor unit 3

      Declaration

      Swift

      static let JOD: Currency
    • JPY

      Yen (JPY) with minor unit 0

      Declaration

      Swift

      static let JPY: Currency
    • KES

      Kenyan Shilling (KES) with minor unit 2

      Declaration

      Swift

      static let KES: Currency
    • KGS

      Som (KGS) with minor unit 2

      Declaration

      Swift

      static let KGS: Currency
    • KHR

      Riel (KHR) with minor unit 2

      Declaration

      Swift

      static let KHR: Currency
    • KMF

      Comorian Franc (KMF) with minor unit 0

      Declaration

      Swift

      static let KMF: Currency
    • KPW

      North Korean Won (KPW) with minor unit 2

      Declaration

      Swift

      static let KPW: Currency
    • KRW

      Won (KRW) with minor unit 0

      Declaration

      Swift

      static let KRW: Currency
    • KWD

      Kuwaiti Dinar (KWD) with minor unit 3

      Declaration

      Swift

      static let KWD: Currency
    • KYD

      Cayman Islands Dollar (KYD) with minor unit 2

      Declaration

      Swift

      static let KYD: Currency
    • KZT

      Tenge (KZT) with minor unit 2

      Declaration

      Swift

      static let KZT: Currency
    • LAK

      Lao Kip (LAK) with minor unit 2

      Declaration

      Swift

      static let LAK: Currency
    • LBP

      Lebanese Pound (LBP) with minor unit 2

      Declaration

      Swift

      static let LBP: Currency
    • LKR

      Sri Lanka Rupee (LKR) with minor unit 2

      Declaration

      Swift

      static let LKR: Currency
    • LRD

      Liberian Dollar (LRD) with minor unit 2

      Declaration

      Swift

      static let LRD: Currency
    • LSL

      Loti (LSL) with minor unit 2

      Declaration

      Swift

      static let LSL: Currency
    • LYD

      Libyan Dinar (LYD) with minor unit 3

      Declaration

      Swift

      static let LYD: Currency
    • MAD

      Moroccan Dirham (MAD) with minor unit 2

      Declaration

      Swift

      static let MAD: Currency
    • MDL

      Moldovan Leu (MDL) with minor unit 2

      Declaration

      Swift

      static let MDL: Currency
    • MGA

      Malagasy Ariary (MGA) with minor unit 2

      Declaration

      Swift

      static let MGA: Currency
    • MKD

      Denar (MKD) with minor unit 2

      Declaration

      Swift

      static let MKD: Currency
    • MMK

      Kyat (MMK) with minor unit 2

      Declaration

      Swift

      static let MMK: Currency
    • MNT

      Tugrik (MNT) with minor unit 2

      Declaration

      Swift

      static let MNT: Currency
    • MOP

      Pataca (MOP) with minor unit 2

      Declaration

      Swift

      static let MOP: Currency
    • MRO

      Ouguiya (MRO) with minor unit 2

      Declaration

      Swift

      static let MRO: Currency
    • MUR

      Mauritius Rupee (MUR) with minor unit 2

      Declaration

      Swift

      static let MUR: Currency
    • MVR

      Rufiyaa (MVR) with minor unit 2

      Declaration

      Swift

      static let MVR: Currency
    • MWK

      Malawi Kwacha (MWK) with minor unit 2

      Declaration

      Swift

      static let MWK: Currency
    • MXN

      Mexican Peso (MXN) with minor unit 2

      Declaration

      Swift

      static let MXN: Currency
    • MYR

      Malaysian Ringgit (MYR) with minor unit 2

      Declaration

      Swift

      static let MYR: Currency
    • MZN

      Mozambique Metical (MZN) with minor unit 2

      Declaration

      Swift

      static let MZN: Currency
    • NAD

      Namibia Dollar (NAD) with minor unit 2

      Declaration

      Swift

      static let NAD: Currency
    • NGN

      Naira (NGN) with minor unit 2

      Declaration

      Swift

      static let NGN: Currency
    • NIO

      Cordoba Oro (NIO) with minor unit 2

      Declaration

      Swift

      static let NIO: Currency
    • NOK

      Norwegian Krone (NOK) with minor unit 2

      Declaration

      Swift

      static let NOK: Currency
    • NPR

      Nepalese Rupee (NPR) with minor unit 2

      Declaration

      Swift

      static let NPR: Currency
    • NZD

      New Zealand Dollar (NZD) with minor unit 2

      Declaration

      Swift

      static let NZD: Currency
    • OMR

      Rial Omani (OMR) with minor unit 3

      Declaration

      Swift

      static let OMR: Currency
    • PAB

      Balboa (PAB) with minor unit 2

      Declaration

      Swift

      static let PAB: Currency
    • PEN

      Sol (PEN) with minor unit 2

      Declaration

      Swift

      static let PEN: Currency
    • PGK

      Kina (PGK) with minor unit 2

      Declaration

      Swift

      static let PGK: Currency
    • PHP

      Philippine Piso (PHP) with minor unit 2

      Declaration

      Swift

      static let PHP: Currency
    • PKR

      Pakistan Rupee (PKR) with minor unit 2

      Declaration

      Swift

      static let PKR: Currency
    • PLN

      Zloty (PLN) with minor unit 2

      Declaration

      Swift

      static let PLN: Currency
    • PYG

      Guarani (PYG) with minor unit 0

      Declaration

      Swift

      static let PYG: Currency
    • QAR

      Qatari Rial (QAR) with minor unit 2

      Declaration

      Swift

      static let QAR: Currency
    • RON

      Romanian Leu (RON) with minor unit 2

      Declaration

      Swift

      static let RON: Currency
    • RSD

      Serbian Dinar (RSD) with minor unit 2

      Declaration

      Swift

      static let RSD: Currency
    • RUB

      Russian Ruble (RUB) with minor unit 2

      Declaration

      Swift

      static let RUB: Currency
    • RWF

      Rwanda Franc (RWF) with minor unit 0

      Declaration

      Swift

      static let RWF: Currency
    • SAR

      Saudi Riyal (SAR) with minor unit 2

      Declaration

      Swift

      static let SAR: Currency
    • SBD

      Solomon Islands Dollar (SBD) with minor unit 2

      Declaration

      Swift

      static let SBD: Currency
    • SCR

      Seychelles Rupee (SCR) with minor unit 2

      Declaration

      Swift

      static let SCR: Currency
    • SDG

      Sudanese Pound (SDG) with minor unit 2

      Declaration

      Swift

      static let SDG: Currency
    • SEK

      Swedish Krona (SEK) with minor unit 2

      Declaration

      Swift

      static let SEK: Currency
    • SGD

      Singapore Dollar (SGD) with minor unit 2

      Declaration

      Swift

      static let SGD: Currency
    • SHP

      Saint Helena Pound (SHP) with minor unit 2

      Declaration

      Swift

      static let SHP: Currency
    • SLL

      Leone (SLL) with minor unit 2

      Declaration

      Swift

      static let SLL: Currency
    • SOS

      Somali Shilling (SOS) with minor unit 2

      Declaration

      Swift

      static let SOS: Currency
    • SRD

      Surinam Dollar (SRD) with minor unit 2

      Declaration

      Swift

      static let SRD: Currency
    • SSP

      South Sudanese Pound (SSP) with minor unit 2

      Declaration

      Swift

      static let SSP: Currency
    • STD

      Dobra (STD) with minor unit 2

      Declaration

      Swift

      static let STD: Currency
    • SVC

      El Salvador Colon (SVC) with minor unit 2

      Declaration

      Swift

      static let SVC: Currency
    • SYP

      Syrian Pound (SYP) with minor unit 2

      Declaration

      Swift

      static let SYP: Currency
    • SZL

      Lilangeni (SZL) with minor unit 2

      Declaration

      Swift

      static let SZL: Currency
    • THB

      Baht (THB) with minor unit 2

      Declaration

      Swift

      static let THB: Currency
    • TJS

      Somoni (TJS) with minor unit 2

      Declaration

      Swift

      static let TJS: Currency
    • TMT

      Turkmenistan New Manat (TMT) with minor unit 2

      Declaration

      Swift

      static let TMT: Currency
    • TND

      Tunisian Dinar (TND) with minor unit 3

      Declaration

      Swift

      static let TND: Currency
    • TOP

      Pa’anga (TOP) with minor unit 2

      Declaration

      Swift

      static let TOP: Currency
    • TRY

      Turkish Lira (TRY) with minor unit 2

      Declaration

      Swift

      static let TRY: Currency
    • TTD

      Trinidad and Tobago Dollar (TTD) with minor unit 2

      Declaration

      Swift

      static let TTD: Currency
    • TZS

      Tanzanian Shilling (TZS) with minor unit 2

      Declaration

      Swift

      static let TZS: Currency
    • UAH

      Hryvnia (UAH) with minor unit 2

      Declaration

      Swift

      static let UAH: Currency
    • UGX

      Uganda Shilling (UGX) with minor unit 0

      Declaration

      Swift

      static let UGX: Currency
    • USD

      US Dollar (USD) with minor unit 2

      Declaration

      Swift

      static let USD: Currency
    • UYU

      Peso Uruguayo (UYU) with minor unit 2

      Declaration

      Swift

      static let UYU: Currency
    • UZS

      Uzbekistan Sum (UZS) with minor unit 2

      Declaration

      Swift

      static let UZS: Currency
    • VEF

      Bolívar (VEF) with minor unit 2

      Declaration

      Swift

      static let VEF: Currency
    • VND

      Dong (VND) with minor unit 0

      Declaration

      Swift

      static let VND: Currency
    • VUV

      Vatu (VUV) with minor unit 0

      Declaration

      Swift

      static let VUV: Currency
    • WST

      Tala (WST) with minor unit 2

      Declaration

      Swift

      static let WST: Currency
    • XAF

      CFA Franc BEAC (XAF) with minor unit 0

      Declaration

      Swift

      static let XAF: Currency
    • XCD

      East Caribbean Dollar (XCD) with minor unit 2

      Declaration

      Swift

      static let XCD: Currency
    • XOF

      CFA Franc BCEAO (XOF) with minor unit 0

      Declaration

      Swift

      static let XOF: Currency
    • XPF

      CFP Franc (XPF) with minor unit 0

      Declaration

      Swift

      static let XPF: Currency
    • YER

      Yemeni Rial (YER) with minor unit 2

      Declaration

      Swift

      static let YER: Currency
    • ZAR

      Rand (ZAR) with minor unit 2

      Declaration

      Swift

      static let ZAR: Currency
    • ZMW

      Zambian Kwacha (ZMW) with minor unit 2

      Declaration

      Swift

      static let ZMW: Currency
    • ZWL

      Zimbabwe Dollar (ZWL) with minor unit 2

      Declaration

      Swift

      static let ZWL: Currency