Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Quantity

hallee edited this page May 10, 2020 · 1 revision

Quantity

Quantity is a type wrapper for integers that interfaces more cleanly with Alpaca’s API.

public struct Quantity: Hashable

Alpaca sometimes returns strings and sometimes numbers for quantity values. This type properly decodes from JSON in either case.

Inheritance

AdditiveArithmetic, Codable, Comparable, CustomDebugStringConvertible, CustomStringConvertible, ExpressibleByIntegerLiteral, Hashable, Numeric

Initializers

init(_:)

init(_ value: Int)

init(integerLiteral:)

public init(integerLiteral value: Int)

init(from:)

public init(from decoder: Decoder) throws

init?(exactly:)

public init?<T>(exactly source: T) where T: BinaryInteger

Properties

value

var value: Int

description

var description: String

debugDescription

var debugDescription: String

magnitude

var magnitude: Quantity

Methods

encode(to:)

public func encode(to encoder: Encoder) throws

<(lhs:rhs:)

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

+(lhs:rhs:)

public static func +(lhs: Quantity, rhs: Quantity) -> Quantity

-(lhs:rhs:)

public static func -(lhs: Quantity, rhs: Quantity) -> Quantity

*(lhs:rhs:)

public static func *(lhs: Quantity, rhs: Quantity) -> Quantity

/(lhs:rhs:)

public static func /(lhs: Quantity, rhs: Quantity) -> Quantity

*=(lhs:rhs:)

public static func *=(lhs: inout Quantity, rhs: Quantity)

/=(lhs:rhs:)

public static func /=(lhs: inout Quantity, rhs: Quantity)

%(lhs:rhs:)

public static func %(lhs: inout Quantity, rhs: Quantity) -> Quantity
Clone this wiki locally