[Swift] IAP SKProduct price with local currency

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
extension SKProduct {
var localizedPrice: String {
let formatter = NumberFormatter()
formatter.numberStyle = .currency
formatter.locale = priceLocale
return formatter.string(from: price)!
}
}
extension SKProduct { var localizedPrice: String { let formatter = NumberFormatter() formatter.numberStyle = .currency formatter.locale = priceLocale return formatter.string(from: price)! } }
extension SKProduct {
    var localizedPrice: String {
        let formatter = NumberFormatter()
        formatter.numberStyle = .currency
        formatter.locale = priceLocale
        return formatter.string(from: price)!
    }
}