Posting
public class Posting
extension Posting: CustomStringConvertible
extension Posting: Equatable
extension Posting: Hashable
A Posting contains an AccountName with the corresponding Amount,
as well as the price and cost (if applicable).
-
AccountNameof the account the posting is inDeclaration
Swift
public let accountName: AccountName -
Price amount per unit
Declaration
Swift
public let price: Amount? -
Total price amount
Declaration
Swift
public let totalPrice: Amount? -
Type of price specification for the original input
Declaration
Swift
public let priceType: PostingPriceType? -
MetaData of the Posting
Declaration
Swift
public let metaData: [String : String] -
Creats an posting with the given parameters
Declaration
Swift
public init(accountName: AccountName, amount: Amount, price: Amount? = nil, cost: Cost? = nil, metaData: [String : String] = [:])Parameters
accountNameamountpricecostmetaDatametadata dictionary
-
Creats an posting with the given parameters including price type
Throws
PostingError if price and priceType validation failsDeclaration
Swift
public init( accountName: AccountName, amount: Amount, price: Amount?, priceType: PostingPriceType? = nil, cost: Cost? = nil, metaData: [String: String] = [:] ) throwsParameters
accountNameamountpricepriceTypeoptional type of price specification
cost -
String to describe the posting in the ledget file
Declaration
Swift
public var description: String { get } -
Compares two postings
If a
priceis set it must matchDeclaration
Swift
public static func == (lhs: Posting, rhs: Posting) -> BoolParameters
lhsfirst posting
rhssecond posting
Return Value
if the accountName, ammount, meta data and price are the same on both postings
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
View on GitHub
Install in Dash