SKProduct price is a NSDecimalNumber object, so one way you could do this would be to extend the NSDecimalNumber class. Here's my Swift code for this:
extension NSDecimalNumber {
func asCurrency(locale:NSLocale) -> String? {
var numberFormatter = NSNumberFormatter()
numberFormatter.formatterBehavior = NSNumberFormatterBehavior.Behavior10_4
numberFormatter.numberStyle = NSNumberFormatterStyle.CurrencyStyle
numberFormatter.locale = locale
return numberFormatter.stringFromNumber(self)
}
}
in Objective-C it would look like this:
@interface NSDecimalNumber (CurrencyExtension)
- (NSString*) asCurrency: (NSLocale *)locale;
@end
@implementation NSDecimalNumber (DellExtensions)
- (NSString*) asCurrency: (NSLocale *)locale {
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[numberFormatter setLocale:product.priceLocale];
return [numberFormatter stringFromNumber:product.price];
}
@end