Skip to content

Instantly share code, notes, and snippets.

@hwjeremy
Last active July 19, 2018 03:43
Embed
What would you like to do?
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