Amatino 0.0.7 macOS & iOS
Amatino Swift 0.0.7 is now available! You can install it via Carthage or get the source code from GitHub. 0.0.7 is a major new release that adds significant capability. The powerful Tree, Position, and Performance objects are now available. Here's the full change-log:
- Remove
InternalLibraryError
, which sneakily survived the error consolidation purge in 0.0.6 - Add
Account.update()
method - Add
Account.delete()
method - Add
Account.deleteRecursively()
method - Add
Tree
class - Add
Position
class - Add
Performance
class - Add
Node
protocol - Add
Node
conformingTreeNode
andPlaceholderNode
classes (used byTree
,Position
, andPerformance
) - Consolidate
SessionCreateArguments
&SessionAttributes
intoSession
- Consolidate
BalanceRetrieveArguments
intoBalance
- Drastically simplified and empowered the internal
EntityObject
protocol, reducing code complexity and duplication (does not affect public API) - Added unit tests for new features
Plant some Trees
Trees present the entire chart of accounts of an Entity as a hierarchical object. Each node in the Tree summarises an Account, including an individual and recursive balances.Each node is represented by an instance of a class conforming to the Node
protocol. Two such classes existing: TreeNode
and PlaceholderNode
.
TreeNodes
present summarised account data, including individual and recursive balances. PlaceholderNodes stand in for TreeNodes
where the requesting User does not have read permissions for the Account in question. A PlaceholderNode still includes children, which may include TreeNodes if the User has permission to read from accounts further down the hierarchy.
try Tree.retrieve(
session: session,
entity: starkIndustries,
globalUnit: usd,
callback: { (error: Error?, tree: Tree?) in {
// tree.accounts contains a hierachary of all
// Accounts in this entity, as either TreeNode
// or PlaceholderNode instances
})
Determine Position
Positions are generic representations of the accounting construct variously known as a balance sheet, statement of financial position, or something else depending on your jurisdiction. They include hierarchical representations of all asset, liability, and equity Accounts inside an Entity.
Like the Tree, each Account is represented by an instance of an object conforming to the Node
protocol.
try Position.retrieve(
session: session,
entity: starkIndustries,
globalUnit: usd,
callback: { (error, position) in
// position.assets, position.liabilities,
// and position.equities combine to give
// a financial position for the Entity.
})
Measure Performance
Performances are generic representations of the accounting construct variously known as an income statement, statement of financial performance, or comprehensive income statement, depending on your jurisdiction. They include hierarchical representations of all income and expense accounts inside an Entity.
Like the Tree and Position objects, each Account is represented by an instance of an object conforming to the Node
protocol.
try Performance.retrieve(
session: session,
entity: starkIndustries,
startTime: Date(timeIntervalSinceNow: (-3600*24*10)),
endTime: Date(),
globalUnit: usd,
callback: { (error, performance) in
// performance.incomeAccounts & performance.expenseAccounts
// contain the performance of the Entity over the specified
// timeframe
})
Updating & Deleting Accounts
Account instances now feature.update()
and delete()
methods, which do what it says on the tin. Here's an example of an update operation:
try account.update(
name: "Newly updated account name",
parent: nil,
type: account.type, // using the existing value
counterParty: nil,
colour: nil,
globalUnit: USD,
callback: { (error, account) in
// The returned Account instance is updated
})
Delete operations require a bit of thought. Deleting an Account does not delete any Transactions with Entries party to that Account. As such, you must supply an Account you wish to transfer any Entries to upon deletion. Here's an example:
try account.delete(
entryReplacement: cash,
callback: { (error) in
// A lack of error indicates the Account is a goner
})