Price
public struct Price : CustomStringConvertible, Codable
extension Price: Equatable
The price of something of a currency and the amount of that currency
-
The amount
Declaration
Swift
public let amount: Decimal
-
The currency in which the price is stated (3-character alphabetic code defined by ISO 4217)
Declaration
Swift
public let currency: String
-
Initializes the price
Declaration
Swift
public init(_ amount: Double, _ currency: String)
Parameters
amount
The amount as a Double
currency
The currency in which the price is stated (3-character alphabetic code defined by ISO 4217)
-
String representation of the price
Declaration
Swift
public var description: String { get }
-
Test whether two prices are equivalent Parameters: - lhs: The first price to compare - rhs: The second price to compare
Declaration
Swift
public static func == (lhs: Price, rhs: Price) -> Bool