I am having an In-App-Purchase for an iPhone app.
I want to display the price in the users local currency in a UILabel. For this I need the price & currency in a
Using computed properties creates cleaner code for Objective-C scenario because it doesn't need [] ;)
@objc public extension SKProduct {
var priceAsString: String? {
let formatter = NumberFormatter()
formatter.formatterBehavior = .behavior10_4
formatter.numberStyle = .currency
formatter.locale = self.priceLocale
formatter.string(from: self.price)
return formatter.string(from: self.price)
}
}
NOTE : Don't forget import StoreKit