Decimal
public extension Decimal
-
Constructs a
MonetaryAmount
from aDecimal
with a givenCurrency
Example:
let money = Decimal(string: "28.529372")!.in(.USD)
Declaration
Swift
func `in`(_ currency: Currency) -> MonetaryAmount
Parameters
currency
The target currency for the amount, e.g.
Currency.USD
Return Value
A
MonetaryAmount
fromself
with the givenCurrency