Cost

public class Cost
extension Cost: CustomStringConvertible
extension Cost: Equatable
extension Cost: Hashable

Cost of a posting

  • Amount

    Declaration

    Swift

    public let amount: Amount?
  • Optional date to identify a lot in the inventory - if no date is set for positive amount, the transactions date is used

    Declaration

    Swift

    public let date: Date?
  • Optional label to identify a lot in the inventory

    Declaration

    Swift

    public let label: String?
  • Creates a Cost

    Throws

    if the cost cannot be created, e.g. if the amount is negative

    Declaration

    Swift

    public init(amount: Amount?, date: Date?, label: String?) throws

    Parameters

    amount

    optional Amount

    date

    optinal Date

    label

    optinal label String

  • String to describe the cost in the ledger file

    Declaration

    Swift

    public var description: String { get }
  • Compares two Costs

    Declaration

    Swift

    public static func == (lhs: Cost, rhs: Cost) -> Bool

    Parameters

    lhs

    first cost

    rhs

    second const

    Return Value

    True if the costs are the same, false otherwise

  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)