Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Add XAF, XOF and XPF currencies #24

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Sources/Money/Currency.swift: Resources/iso4217.csv

%.swift: %.swift.gyb
@gyb --line-directive '' -o $@ $<
@./gyb --line-directive '' -o $@ $<

.PHONY:
clean:
Expand Down
3 changes: 3 additions & 0 deletions Resources/iso4217.csv
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ VEF,Bolívar,2
VND,Dong,0
VUV,Vatu,0
WST,Tala,2
XAF,CFA franc BEAC,0
XCD,East Caribbean Dollar,2
XOF,CFA franc BCEAO,0
XPF,CFP franc (franc Pacifique),0
YER,Yemeni Rial,2
ZAR,Rand,2
ZMW,Zambian Kwacha,2
Expand Down
48 changes: 48 additions & 0 deletions Sources/Money/Currency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ public func iso4217Currency(for code: String) -> CurrencyType.Type? {
case "VND": return VND.self
case "VUV": return VUV.self
case "WST": return WST.self
case "XAF": return XAF.self
case "XCD": return XCD.self
case "XOF": return XOF.self
case "XPF": return XPF.self
case "YER": return YER.self
case "ZAR": return ZAR.self
case "ZMW": return ZMW.self
Expand Down Expand Up @@ -2543,6 +2546,21 @@ public enum WST: CurrencyType {
}
}

/// CFA franc BEAC (XAF)
public enum XAF: CurrencyType {
public static var code: String {
return "XAF"
}

public static var name: String {
return "CFA franc BEAC"
}

public static var minorUnit: Int {
return 0
}
}

/// East Caribbean Dollar (XCD)
public enum XCD: CurrencyType {
public static var code: String {
Expand All @@ -2558,6 +2576,36 @@ public enum XCD: CurrencyType {
}
}

/// CFA franc BCEAO (XOF)
public enum XOF: CurrencyType {
public static var code: String {
return "XOF"
}

public static var name: String {
return "CFA franc BCEAO"
}

public static var minorUnit: Int {
return 0
}
}

/// CFP franc (franc Pacifique) (XPF)
public enum XPF: CurrencyType {
public static var code: String {
return "XPF"
}

public static var name: String {
return "CFP franc (franc Pacifique)"
}

public static var minorUnit: Int {
return 0
}
}

/// Yemeni Rial (YER)
public enum YER: CurrencyType {
public static var code: String {
Expand Down