Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create an Account in Amatino Swift - A double-entry accounting library for iOS & MacOS
// Amatino Swift: https://github.com/amatino-code/amatino-swift
// Double entry accounting API
try Account.create(
session: session,
entity: starkIndustries,
name: "Suit Cash",
type: .asset,
description: "A stash of cash for building new Iron Man suits",
globalUnit: usd,
callback: { (error: Error?, account: Account?) in
guard error == nil else {
// Handle errors
}
guard let cashAccountId: Int = account?.id else {
// account should never be nil at this point
}
// Do stuff with our new asset Account
print("Create new asset account with ID: \(cashAccountId))
return
})
@hwjeremy

This comment has been minimized.

Copy link
Owner Author

commented Jul 17, 2018

The parameters supplied to Account.create() come from the following examples:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.