Amatino Swift 0.0.11 Released


#1

Originally published at: https://amatino.io/blog/amatino-swift-0-0-11-released/

Amatino Swift 0.0.11 has been released! This is a huge release with wide ranging changes and substantial new features. It is not backwards compatible with 0.0.10, but any code written for 0.0.10 will compile for 0.0.11 with minor adjustments.

  • Almost all asynchronous Amatino methods now accept a (Result<T, Error>) -> Void callback parameter, using the new Swift 5 Result type. The previous (Error?, T?) -> Void parameter remains available. You now have a choice to use either depending on your preferred style.
  • Add Denomination protocol, which codifies the characteristics of CustomUnit and GlobalUnit and allows method signatures accepting either of those classes to be streamlined.
  • Add Denominated protocol, which gives default behaviours to classes denominated in a Denomination, such as Transactions and Ledgers.
  • Renamed many method signatures parameters for more expressive syntax. For example, someMethod(then: (Error?, Object?) rather than someMethod(callback: (Error?, Object?)
  • Remove all use of Int64, replace with Int. Amatino Swift will not function on 32-bit platforms, so the occasional use of Int64 added needless confusion.
  • The AmatinoError case .inconsistentInternalState has been renamed .inconsistentState
  • Publicly exposed Account.create() taking Account.CreateArguments struct. Gives extra flexibility when designing GUI for account creation
  • GlobalUnitList now conforms to the Sequence protocol. I.e. you can loop over the list without needing to access the raw .units property.
  • TheGlobalUnitList units property is now sorted first by GlobalUnit.priority and then alphabetically by GlobalUnit.name
  • AccountType has a new static method, .typeWith(:name), which returns an AccountType with the given name
  • Tree now conforms to the Sequence protocol, iterating over Node conforming objects
  • Multiline strings throughout the library are no longer peppered with \n newlines. For example, AmatinoError messages.
  • Account.CreateArguments now enforces a minimum .name character length of 1.
  • Tree now features a .flatAccounts property, which returns recursive flattened list of all Accounts in the Tree as Node objects. This is effectively a list of all Accounts in an Entity.
  • Add new AccountRepresentative protocol, to which Account, TreeNode and PlaceholderNode conform. Provides base Account metadata - accountId, name, type, and is accepted in many places where Account was formerly required.
  • Fixed an internal typo in Account.DeletionArguments (no effect on public API)
  • Transaction, Balance, Account, Ledger, GlobalUnitList, Performance, Position and Entity methods may no longer throw. Errors are now exclusively handled by the error parameter in respective callbacks.
  • Ledger may now be retrieved with an object conforming to the AccountRepresentative protocol. This saves an intermediary Account retrieval when, for example, retrieving a Ledger based on a Tree node
  • Add User class including create(), retrieve(), delete() methods
  • Add User class lifecycle testing
  • Ledger.nextPage() renamed .retrieveNextPage()
  • RecursiveLedger.nextPage() renamed .retrieveNextPage()
  • Add Session.delete() method
Amatino Swift source code is available on GitHub, and you can add Amatino accounting functionality to your macOS or iOS project via Carthage or CocoaPods.