Get currency symbols from currency code with swift

前端 未结 11 705
星月不相逢
星月不相逢 2020-12-24 12:21

How can I get the currency symbols for the corresponding currency code with Swift (macOS).

Example:

  • EUR = €1.00
  • USD = $1.00<
11条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 12:55

    let countryCode = (Locale.current as NSLocale).object(forKey: .currencySymbol) as? String ?? "$"
    

    Above will give current currency Symbol, For UK it gives me = £ Apple Doc

提交回复
热议问题