Answers for "swift get price in localized currency"

1

get local currency iap swift

extension SKProduct {
    fileprivate static var formatter: NumberFormatter {
        let formatter = NumberFormatter()
        formatter.numberStyle = .currency
        return formatter
    }

    var localizedPrice: String {
        if self.price == 0.00 {
            return "Get"
        } else {
            let formatter = SKProduct.formatter
            formatter.locale = self.priceLocale

            guard let formattedPrice = formatter.string(from: self.price) else {
                return "Unknown Price"
            }

            return formattedPrice
        }
    }
}
Posted by: Guest on April-16-2020

Code answers related to "swift get price in localized currency"

Code answers related to "Swift"

Browse Popular Code Answers by Language