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
PriceinstanceReturns
nilif the provided amount cannot be represented (such as if it is negative).Declaration
Swift
@objc public init?(amount: Decimal)Parameters
amountThe magnitude of the price
-
Override for
Hashableprotocol 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
Priceobjects is assessed by comparing its numeric componentsDeclaration
Swift
public override func isEqual(_ object: Any?) -> BoolParameters
objectThe object to be compared to the receiver
Return Value
trueif the receiver andobjectare equal, otherwisefalse -
Encodes an instance of
PriceDeclaration
Swift
public func encode(to encoder: Encoder) throws -
Retrieves
Stringrepresentation ofPriceDeclaration
Swift
public override var description: String { get }
Price Class Reference