mike vorisis
mike vorisis

Reputation: 2832

How to convert ISO 4217 code to currency code in swift

Is there any way to convert ISO 4217 numeric code to currency code like this:

978 -> EUR

I checked Apple docs and I found only how can I take EUR

Here is what I searched:

Locale

Locale spesific

Upvotes: 3

Views: 1436

Answers (2)

mike vorisis
mike vorisis

Reputation: 2832

As rmaddy suggested I made a plist with iso4217 codes and did my own mapping, here is the playground for anyone who wants it.

Upvotes: 3

rmaddy
rmaddy

Reputation: 318955

There is no API available in iOS (or any other Apple OS) that provides information about ISO 4217 codes. You will need to create your own mapping.

I would find a definitive list of codes (perhaps Wikipedia or the ISO website) and put the codes in a plist file. Then write a simple Locale extension that lets you get a currency code from a 4217 code.

Upvotes: 3

Related Questions