Changelog History
-
v1.3 Changes
April 04, 2016โ Added
- ๐ Swift 2.2 support!
-
v1.2.4 Changes
February 13, 2016โ Added
- RawRepresentable conformance to
JSON
- This includes a failable initializer with a single AnyObject argument and a compute property named
rawValue
of type AnyObject
- This includes a failable initializer with a single AnyObject argument and a compute property named
Function for converting a
JSON
object back to raw NSDatado { let data = try json.rawData(.PrettyPrinted) // do something with data} catch let error = JSON.DataError {}catch {}
- RawRepresentable conformance to
-
v1.2.3 Changes
January 20, 2016โ Added
- ๐ฆ Swift Package Manager support!
-
v1.2.2 Changes
November 18, 2015โก๏ธ Updated
๐ Built-in date formatter to accept non-GMT date formats. ISO8601 formatting (
yyyy-MM-dd'T'HH:mm:ss.SSSZ
) is still required, but a future release will contain support for more formats. In the meantime, you can use this pattern if your models require a different format:private let dateFormatter = { let formatter = NSDateFormatter() formatter.format = "yyyy-MM-dd"return formatter }()private let _date = Property<String>(key: "date")public var date: NSDate? { guard let date = _date.value else { return nil } return dateFormatter.dateFromString(date) }
๐ Fixed
- ๐ Issue where time zones weren't respected while parsing JSON to/from NSDate objects
-
v1.2.1 Changes
October 29, 2015๐ Fixed
- ๐ An issue with the default implementation of
fromJSON
forModel
types. The implementation worked without issue in simulator builds, but caused crashing on device builds. Attempting to access thedynamicType
onSelf
currently causes problems on device builds, sodynamicType
is no longer used; however,fromJSON
can still be overridden in the subclass if needed.
โก๏ธ Updated
- The convenience initializers on
Model
are now designated initializers. This allows these initializers to be overridden in subclasses.
- ๐ An issue with the default implementation of
-
v1.2 Changes
October 27, 2015โ Added
hasValue
andhasKey
toJSON
(replacesisNil
). The behavior ofisNil
was not always clear, in cases where the JSON contained a valid key but a null value.hasValue
andhasKey
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
-
v1.1 Changes
September 17, 2015โ Added
- ๐ Swift 2 support!
- 0๏ธโฃ Default implementations for
Model
andRawRepresentable
(String and Int) types. isNil
property onJSON
โก๏ธ Updated
- Conformance to Equatable for
JSON
,Property
,PropertyArray
, andPropertyDictionary
๐ Renamed
ModelRocket
class toModel
, to fix a namespacing issue caused by the framework and class sharing the same name.
-
v1.0
August 25, 2015