Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Retrieve a Global Unit in Amatino Swift - A double-entry accounting library / framework for iOS & MacOS
// Amatino Swift:
// Double entry accounting API
unitId: 5, // The ID for U.S. dollars
session: session,
callback: { (error: Error?, unit: GlobalUnit?) in
guard error == nil else {
// Handle errors, e.g. a 404 for an unknown unit
guard let usd: GlobalUnit = unit else {
// Should never happen, but guarding against nil is
// good karma
// Do stuff with our shiny new unit
print("Retrieved Global Unit with code: \(usd.code)")

This comment has been minimized.

Copy link
Owner Author

hwjeremy commented Jul 17, 2018

Global Units are units of account available across all Entities in Amatino. They are currently all currencies (E.g. USD, EUR, AUD) but will not necessarily be so in future. Hence the generic name.

The session instance used in this example may be seen in the Create Session gist

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.