Account
public class Account : AccountItem
extension Account: CustomStringConvertible
extension Account: Equatable
Class with represents an Account with a name, CommoditySymbol, opening and closing date
It does hot hold any Transaction
s
-
Name of the account
Declaration
Swift
public let name: AccountName
-
BookingMethod
of the accountDeclaration
Swift
public let bookingMethod: BookingMethod
-
Commodity
of this accountDeclaration
Swift
public let commoditySymbol: CommoditySymbol?
-
MetaData of the Account
Declaration
Swift
public let metaData: [String : String]
-
Optional date of opening. If it exists
isPostingValid(:)
checks that the transaction is on or after this dateDeclaration
Swift
public let opening: Date?
-
Optional closing date. If it exists
isPostingValid(:)
checks that the transaction is before or on this dateDeclaration
Swift
public let closing: Date?
-
Balance asserts for this account
Declaration
Swift
public internal(set) var balances: [Balance] { get }
-
Declaration
Swift
public var nameItem: String { get }
-
Creates an Account
Declaration
Swift
public init( name: AccountName, bookingMethod: BookingMethod = .strict, commoditySymbol: CommoditySymbol? = nil, opening: Date? = nil, closing: Date? = nil, metaData: [String: String] = [:] )
Parameters
name
a vaild name for the account
bookingMethod
bookingMethods, defaults to .strict
-
Returns the Acount opening and closing string for the ledger.
If no open date is set it returns an empty string, if only the opening is set the closing line is ommitted
Declaration
Swift
public var description: String { get }
-
Compare the name, commodity and meta data as well as the opening and closing of two Accounts.
This does not compare
Transaction
s as they are not part of AccountsDeclaration
Swift
public static func == (lhs: Account, rhs: Account) -> Bool
Return Value
if the accounts are equal