Created
July 19, 2018 03:45
-
-
Save hwjeremy/4445f3ebd131c44480c95f389ae4e8e9 to your computer and use it in GitHub Desktop.
Find a specific currency 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 | |
guard let USD: GlobalUnit = currencies.findWith(code: "USD") else { | |
// .findWith() returns an optional. If we end up here, Amatino | |
// doesn't support a currency with the supplied code. | |
} | |
// Do cool stuff with our new currency | |
print("Loaded a currency! Name: \(USD.name)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
currencies
variable referred to in this example comes from the GlobalUnitList gist