Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

Unbox 2.2.0

Compare
Choose a tag to compare
@JohnSundell JohnSundell released this 23 Oct 23:21
· 82 commits to master since this release

This version is focused on increasing Unbox's speed - it's now up to 50% faster compared to the previous version! It also contains error reporting improvements.

Perfrormance

  • Unboxing collections is now up to 25% faster, because of decreased iteration complexity.
  • Unboxing with key paths is now up to 50% faster, since associated enum values is no longer used.

The next releases of Unbox will continue to make performance improvements in order to make decoding your JSON even more... eh... swift 😉

Error reporting

Unbox now produces a coherent, easy to read error type. UnboxError has been made into a struct instead of an enum, and when printed - it produces easily debuggable information.

For example, here's how an invalid array element would be reported in Unbox 2.1 or earlier:

[UnboxError] Invalid value ([1, "Bad value", 3]) for key "array"

And here's how Unbox 2.2 reports the same error:

[UnboxError] An error occured while unboxing path "model.array": Invalid array element ("Bad value") at index 1. 

This also means you only have to catch one error type (UnboxError) instead of performing complex pattern matching.