ModelRocket v1.2 Release Notes

Release Date: 2015-10-27 // over 8 years ago
  • ➕ Added

    • hasValue and hasKey to JSON (replaces isNil). The behavior of isNil was not always clear, in cases where the JSON contained a valid key but a null value. hasValue and hasKey clears this up.

      let json: JSON = ["string" : NSNull()] json["string"].hasValue// falsejson["string"].hasKey// true

    🛠 Fixed

    • Issue where subclassing a Model subclass resulted in broken JSONTransformable conformance.

      let json: JSON = ["cars" : [ [ "model" : "BMW", "year" : 2015, "number_of_doors" : 4] ] ]class Vehicle: Model, JSONTransformable { let model = Property<String>(key: "model") let year = Property<Int>(key: "year") }class Car: Vehicle { let numberOfDoors = Property<Int>(key: "number_of_doors") }class Garage: Model { let cars = PropertyArray<Car>(key: "cars") }let garage = Garage(json: json)// previouslygarage.cars.first// nil// nowgarage.cars.first// valid Car object