Skip to content

Instantly share code, notes, and snippets.

@hwjeremy
Created July 19, 2018 03:45
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/4445f3ebd131c44480c95f389ae4e8e9 to your computer and use it in GitHub Desktop.
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
// 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)")
@hwjeremy
Copy link
Author

The currencies variable referred to in this example comes from the GlobalUnitList gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment