Get local currency in swift

后端 未结 2 957
灰色年华
灰色年华 2021-01-03 23:55

I am setting up an little in app purchase store for muliple countries. How can I figure out that I have to show up the price in Dollar, Euro etc... I think it have to do wit

2条回答
  •  [愿得一人]
    2021-01-04 00:31

    for swift3

    //User region setting return
    let locale = Locale.current //NSLocale.current
    
    //Returns true if the locale uses the metric system (Note: Only three countries do not use the metric system: the US, Liberia and Myanmar.)
    let isMetric = locale.usesMetricSystem
    
    //Returns the currency code of the locale. For example, for “zh-Hant-HK”, returns “HKD”.  
    let currencyCode  = locale.currencyCode
    
    //Returns the currency symbol of the locale. For example, for “zh-Hant-HK”, returns “HK$”.
    let currencySymbol = locale.currencySymbol
    

提交回复
热议问题