Price
@objc(GFYPrice)
public class Price : NSObject, Encodable
Represents a positive monetary price value
-
The magnitude of the price to two decimal places
Declaration
Swift
@objc public var amount: Decimal { get }
-
Creates a
Price
instanceReturns
nil
if the provided amount cannot be represented (such as if it is negative).Declaration
Swift
@objc public init?(amount: Decimal)
Parameters
amount
The magnitude of the price
-
Override for
Hashable
protocol implementation to hash based on numeric valueDeclaration
Swift
public override var hash: Int { get }
-
Returns a Boolean value that indicates whether the receiver and a given object are equal.
Equality for
Price
objects is assessed by comparing its numeric componentsDeclaration
Swift
public override func isEqual(_ object: Any?) -> Bool
Parameters
object
The object to be compared to the receiver
Return Value
true
if the receiver andobject
are equal, otherwisefalse
-
Encodes an instance of
Price
Declaration
Swift
public func encode(to encoder: Encoder) throws
-
Retrieves
String
representation ofPrice
Declaration
Swift
public override var description: String { get }