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

Releases: JohnSundell/Unbox

Unbox 1.3.1

07 Feb 22:02
Compare
Choose a tag to compare

This release focuses on fixing a bug caused by treating keys with dots as key paths (thanks to @sandalsoft for reporting it and to @mr-v for input on how to fix it).

A isKeyPath parameter has been added to all Unboxer.unbox() overloads, so that using the key path support now requires the API user to explicity state that intention.

If you were relying on the implicit treatment of strings with dots as key paths, this release will be a breaking change. The only thing you need to do though is to send isKeyPath: true when unboxing to migrate. For all other users, this is a non-breaking change as the isKeyPath parameter has a default value of false.

Unbox 1.3

16 Jan 20:37
Compare
Choose a tag to compare
  • Added custom unboxing API that enables you to perform custom unboxing logic using a closure.
  • You can now unbox a value from a certain index in a nested array directly.
  • Unbox can now be used in an App extension.
  • Unboxer.dictionary can now be accessed from outside of Unbox.
  • Unboxer.allKeys has been removed in favor of Unboxer.dictionary.
  • Improved compile-time safety for nested Arrays.

Unbox 1.2.3

24 Dec 12:56
Compare
Choose a tag to compare

This release of Unbox is all about nested dictionaries. You can now transform the keys in a nested dictionary to any Hashable type, with the same single unbox() method call. Unbox also will now also stop you at compile time if you accidentially try to unbox a dictionary of nested models that you have not yet implemented Unboxable for.

Unbox 1.2.2

15 Dec 22:58
Compare
Choose a tag to compare

Unbox now provides built-in support for NSDate, through the new UnboxableWithFormatter protocol. This enables you to pass any NSDateFormatter when unboxing a String value - and format the unboxed value into an NSDate instance.

Unbox 1.2.1

05 Dec 09:48
Compare
Choose a tag to compare
  • Unbox CGFloat values directly
  • Podspec now declares tvOS support
  • Minor README fixes

Unbox 1.2

28 Nov 18:32
Compare
Choose a tag to compare
  • Unbox JSON structures that have an array as their root object.
  • More code reuse between Unbox() and UnboxOrThrow() overloads.
  • Misc code cleanups.

Version 1.1 of Unbox

19 Nov 18:58
Compare
Choose a tag to compare

Potentially breaking changes for users of Unbox 1.0

Any instead of AnyObject in context & manual fail APIs
Enables structs to be used as contextual objects, and when manually failing an unboxing process.

fallbackValue renamed to unboxFallbackValue
To avoid conflicting with other methods when confirming to an Unbox protocol.

UnboxTransformer removed in favor of static transformation functions on UnboxableByTransform
Enables transformations to be written directly on the type that is to be transformed, reducing the amount of code and decreasing complexity.

Unboxer.requiredContextWithFallbackValue() has been removed
A new UnboxableWithContext protocol has been introduced for types that require a contextual object to be unboxed, moving this check to compile time instead of rutime, rendering this method obsolete.

Other changes

Unbox enum values directly
You no longer have to implement your own enum value decoding. Make your enum types conform to UnboxableEnum and then just unbox the values as normal:

enum MyEnum: Int, UnboxableEnum {
   case First
   case Second

   static func unboxFallbackValue() {
      return .First
   }
}

struct MyModel: Unboxable {
   let myEnum: MyEnum

   init(unboxer: Unboxer) {
      self.myEnum = unboxer.unbox("myEnum")
   }
}

Allow types to require a contextual object to be unboxed using UnboxableWithContext
This new protocol has another initializer (init(unboxer: Unboxer, context: Self.ContextType)) than the default Unboxable protocol, and requires a contextual object of a certain type to be passed into the unboxing process. This is super useful for managing dependencies between different models, or to pass some form of state into the unboxing process.

Access all keys of the underlying dictionary that's being unboxed
Now available through Unboxer.allKeys. Useful for iterations, checking if a key exists, etc.

Included are also misc documentation fixes.

1.0

08 Nov 22:42
Compare
Choose a tag to compare
1.0

First stable release