Releases: tristanhimmelman/ObjectMapper
Releases · tristanhimmelman/ObjectMapper
`ImmutableMappable` - Support for immutable mappings
- Support of Immutable mappings. Thanks to @devxoul!
- New protocol
ImmutableMappable
which defines a throwinginit
function where immutable mappings can be performed - New operator for Model to JSON generation
>>>
- New protocol
- Bug fix: DateTransforms now marked as
open
Map.currentKey
is now public
Swift 3 support
- Support for Swift 3
- The Mappable extension now supports the MapContext
- Updates to Mapper to make function definitions require named parameters
1.5.0
- ObjectMapper can now be implemented within an extension using the
StaticMappable
protocol. (Thanks @andrebraga)
Below is the new protocol structure
/// BaseMappable should not be implemented directly. Mappable or StaticMappable should be used instead
public protocol BaseMappable {
/// This function is where all variable mappings should occur. It is executed by Mapper during the mapping (serialization and deserialization) process.
mutating func mapping(map: Map)
}
public protocol Mappable: BaseMappable {
/// This function can be used to validate JSON prior to mapping. Return nil to cancel mapping at this point
init?(_ map: Map)
}
public protocol StaticMappable: BaseMappable {
/// This function should return an instance of BaseMappable that ObjectMapper will use for mapping. It can also be used to:
/// 1) provide an existing cached object to be used for mapping
/// 2) return an object of another class (which conforms to Mappable) to be used for mapping. For instance, you may inspect the JSON to infer the type of object that should be used for any given mapping
/// 3) perform validation prior to mapping
static func objectForMapping(map: Map) -> BaseMappable?
}
- Compilation speed improvements (@ivanbruel)
- NSDataTransform
Swift 2.3 and StaticMappable protocol
StaticMappable protocol is a sub protocol of Mappable which provides access to the objectForMapping function
Mappable protocol updates, new MapContext and NSDecimalNumberTransform
- Removed the
MappableCluster
protocol by adding theobjectForMapping
function intoMappable
and adding a default implementation in an extension making it an optional function - Created
MapContext
protocol which can be implemented by developers and used to pass information around during mapping. Pass theMapContext
object intoMapper
ininit
and the context will be available in the Map object (map.context
) during mapping. - Added
NSDecimalNumberTransform
Swift 2.2 warning fixes, Nil object support (Xcode 7.3 required)
- Updates to support Swift 2.2 changes
- JSON containing nil objects is no longer ignored. This is especially important when mapping to an existing object where the developer may want to remove a variable based on a nil JSON object.
OS X Build error fix
Merge pull request #392 from Hearst-DD/bitcode Bitcode
Enabled BITCODE for watchOS and tvOS
1.1.4 Enabled bitcode for watchOS and tvOS
Performance improvement
1.1.3 40-50% performance fix
Exposed JSONDictionary in Map class
Merge pull request #379 from zulkis/master JSONDictionary public getter