Last active
July 19, 2018 03:43
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
session
instance used in this example may be seen in the Create Session gist