Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hwjeremy
Last active July 19, 2018 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hwjeremy/606544767e77da66492c257aa98c2a2d to your computer and use it in GitHub Desktop.
Save hwjeremy/606544767e77da66492c257aa98c2a2d to your computer and use it in GitHub Desktop.
Retrieve available currencies 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 GlobalUnitList.retrieve(
session: session,
callback: { (error: Error?, units: GlobalUnitsList?) in
guard error == nil else {
// Handle errors
}
guard currencies: GlobalUnitList = units else {
// Should never happen, but accidentally
// unwrapping nil angers the startup gods
}
// Do cool stuff with our shiny currency list
print("Retrieved \(currencies.count) currencies")
return
})
@hwjeremy
Copy link
Author

hwjeremy commented Jul 19, 2018

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