Changelog History
-
v4.0.0 Changes
April 03, 2019π This version moves Unbox to Xcode 10.2 and Swift 5, and with that comes some API changes that will require manual fixes for users adopting this new version.
Since Swift now automatically flattens optionals returned from throwing functions called with
try?
, Unbox now uses throwing APIs for all unboxing methods. That means that while in previous versions, youβd unbox an optional property like this:struct User: Unboxable { var name: String?init(unboxer: Unboxer) throws { name = unboxer.unbox(key: "name") } }
Youβll now have to prefix such calls with
try?
:struct User: Unboxable { var name: String?init(unboxer: Unboxer) throws { name = try? unboxer.unbox(key: "name") } }
π While I realize that the above change brings a slight regression in terms of Unboxβs ease-of-use, itβs necessary in order to make Unbox support the latest Swift tools within a reasonable scope, and also moves Unbox's API to be more inline with modern Swift conventions for throwing methods.
π > View build details and download artifacts on buddybuild:
π > Unbox (iOS, Unbox-iOS) -
v3.1.0 Changes
February 09, 2019This version migrates Unbox to Swift 4.2.
π > View build details and download artifacts on buddybuild:
π > Unbox (iOS, Unbox-iOS) -
v3.0.0 Changes
April 30, 2018This version migrates Unbox to Swift 4.1
π > View build details and download artifacts on buddybuild:
π > Unbox (iOS, Unbox-iOS) -
v2.5.0 Changes
June 05, 2017π¦ This version of Unbox adds support for Xcode 9 and Swift 3.2, as well as re-organizes the project to be easier to browse, with separate files for each part of the API. It also enables the tests to be run using the Swift Package Manager.
-
v2.4.0 Changes
February 17, 2017- You can now unbox a dictionary of models directly using the top-level
unbox()
function. Works with bothData
andUnboxableDictionary
. Implemented by @mislavjavor. Decimal
is now a first-class number type, and gets automatically converted from other number types and strings. Implemented by @bencallis.- You can now unbox
Set
directly from an array, without any custom transformation code. Implemented by @hartbit.
- You can now unbox a dictionary of models directly using the top-level
-
v2.3.1 Changes
February 01, 2017More
unbox()
functions that return anArray
can now (optionally) be passed theallowInvalidElements
parameter. -
v2.3.0 Changes
November 30, 2016UnboxPathError
is now public, meaning that the detailed error reporting introduced in2.2
has now been combined with the granularity of earlier versions.UnboxError
is again an enum to enable developers toswitch
on the different cases.- β‘οΈ Xcode settings have now been updated for
8.1
. No more β οΈ. - π± Unbox now has a shiny new logo (kind of shiny anyway, I'm not a designer π).
- When unboxing
Data
to an array, you can now start unboxing at a certain key path. - Unbox can again be used by dragging
Unbox.swift
directly into a project, instead of using it as a library.
-
v2.2.1 Changes
November 04, 2016π This release makes Unbox usable with the new version of the Swift Package Manager.
-
v2.2.0 Changes
October 23, 2016This 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. -
v2.1.1 Changes
October 22, 2016Decimal
can now be unboxed directly (thanks @garnett!)