Get sum from a list of decimal numbers (NSDecimalNumber
):
public var cartTotal: NSDecimalNumber { cart.reduce(NSDecimalNumber(0)) { acc, v in acc.adding(v.price) } }
Get sum from a list of decimal numbers (NSDecimalNumber
):
public var cartTotal: NSDecimalNumber { cart.reduce(NSDecimalNumber(0)) { acc, v in acc.adding(v.price) } }