How to show the monthly price of a yearly subscription in StoreKit 2?

Hi!

I can show the total yearly (or 6-month) auto renewable subscription price using displayPrice just fine, but I also want to show how much that would be per month, as I think its more enticing.

I could just use price and divide by 12 (or 6), but then I wouldn't know how to show the local currency symbol next to the price.

According to my googling this is easy to do in StoreKit 1 using SKProduct, but how do I do it in StoreKit 2 using Product?

Thanks!

PD: I'd also love to be able to test the different locales to make sure their prices/currency symbols are showing correctly.

Replies

You can do something like this. let monthlyPriceDecimal = productItem.price.doubleValue/12 // This will divide the Yearly Value to Monthly. then self.lblYearly.text = "(productItem.priceLocale.currencySymbol ?? "") (String(format: "%.2f", monthlyPriceDecimal)) / Month"