Skip to content

Releases: Anviking/Decodable

Untitled

14 Sep 13:19
Compare
Choose a tag to compare

TypeMismatch NSNull

16 Aug 12:25
Compare
Choose a tag to compare
  • Fixed ignoredInvalidObjects typo in Array extension
  • Marked the T? returning overloads as throwing. However they will catch a NSNull TypeMismatch error.
  • Made catchNull and catchAll functions public
  • Added completely non-throwing =>?overload returning T?
  • Made improvements on how the error path is calculated in nested objects (try and preserve it from the very root object)
  • Various minor changes

Simplicity

14 Aug 10:24
Compare
Choose a tag to compare
  • Use \u{0}-separated string for JSONPaths. This reduces the number of overloads needed. In the future this will make it easier to test and add new overloads with more return-types like T, T?, [T]...
let a = json => "key1" => "key2" => "key3" // is equivlent to
let a = json => "key1\u{0}key2\u{0}key3"
// NOTE: Never actually do this, the character or implementation details might change.
  • Removed DecodableArray<T> and NilFilteringArray<T>. Use either:
[T].decode(object, ignoreInvalidObject: false)
// or 
decodeArray(ignoreInvalidObjects: false)(json: object)
  • Added public parse()-function. This is what all the =>-overloads are calling.
public func parse<T>(json: AnyObject, path: [String], decode: (AnyObject throws -> T)) throws -> T {

NSDictionary

10 Aug 18:00
Compare
Choose a tag to compare
  • Favor use of NSDictionary instead of [String: AnyObject] to avoid performance issues caused by converting between the two.

This is madness

19 Jul 14:52
Compare
Choose a tag to compare
  • Error Paths!
  • More complicated implementation
  • Possible to have [String: Castable] or [String: AnyObject] as final return type.
  • Right associativity (implementation detail, should not affect the basic use-cases)
// j => ("a" => ("b" => "c"))

Power of throws

17 Jul 22:20
Compare
Choose a tag to compare
  • Simple and straightforward first implementation
  • String, Int, Double, Bool, Dictionary
  • T, T?, [T], [T]?
  • Left associativity
// ((j => "a") => "b") => "c"