This is what I do now:
extension Decimal { var formattedAmount: String { let formatter = NumberFormatter() formatter.generatesDecimalNumbers =
This:
formatter.string(from: ...) // requires a NSNumber
You can either do this:
formatter.string(for: self) // which takes Any as argument
Or:
string(from: self as NSDecimalNumber) // cast self to NSDecimalNumber