UnitAmount

@objc(PPCUnitAmount)
@objcMembers
class UnitAmount
extension UnitAmount : CVarArg, Comparable, CustomDebugStringConvertible, CustomStringConvertible, Decodable, Encodable, Equatable, Hashable, NSObjectProtocol

UnitAmount should be used for the following objects:

  • Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.

    This function is the only requirement of the Comparable protocol. The remainder of the relational operator functions are implemented by the standard library for any type that conforms to Comparable.

    Declaration

    Swift

    static func < (lhs: UnitAmount, rhs: UnitAmount) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

  • The three-character ISO-4217 currency code that identifies the currency.

    Declaration

    Swift

    var currencyCode: CurrencyCode? { get }
  • Currency code in text format (example: “USD”)

    Declaration

    Swift

    let currencyCodeString: String?
  • Formatted currency symbol and value (example: “$0.01”)

    Declaration

    Swift

    let currencyFormat: String?
  • Encodes this value into the given encoder.

    If the value fails to encode anything, encoder will encode an empty keyed container in its place.

    This function throws an error if any values are invalid for the given encoder’s format.

    Declaration

    Swift

    func encode(to encoder: Encoder) throws
  • Declaration

    Swift

    init(currencyCode: CurrencyCode, value: String)
  • Creates a new instance by decoding from the given decoder.

    This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

    Declaration

    Swift

    required init(from decoder: Decoder) throws
  • Undocumented

    Declaration

    Swift

    override func isEqual(_ object: Any?) -> Bool
  • The value, which might be: An integer for currencies like JPY that are not typically fractional. A decimal fraction for currencies like TND that are subdivided into thousandths.

    • Maximum length: 32.
    • Pattern: ^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$

    Declaration

    Swift

    let value: String?