All notable changes to this project will be documented in this file.
- Support for Xcode 12.
- Support for Swift Package Manager in Xcode 11 and Xcode 12
- Requires iOS 9 and higher to support Xcode 12
EKSerializer
now usesserializeCollection:withRelationship:
method under the hood instead ofserializeCollection:withMapping:
to support custom serialization resolvers for collection of objects (thanks, @armandzwan)
EKSerializer.serializeCollection:withMapping
in favor ofEKSerializer.serializeCollection:withRelationship
. This allows to support custom serialization resolvers when serializing collections. Similar deprecation applied toserializeCollection:withMapping:fromContext:
.
- Has many relationships now correctly recognize nested custom mappings during serialization (thanks, @armandzwan)
- Added support for recognizing structs as native types, for example
CLLocationCoordinate2D
- #168(thanks, @sebastianludwig)
- Removed too strict generic constraints from
EKMapper
andEKManagedObjectMapper
classes.
EKSerializer
no longer implies that serializable objects need to conform toEKMappingProtocol
orEKManagedMappingProtocol
.
- Fixed a bug in
EKSerializer
that prevented has one relationships from being properly serialized with non-nested keypaths.
- Fixed potential buffer overflow when using scalar Objective-C properties(#155, #156).
- Added support for installation using Carthage and Swift Package Manager.
ignoreMissingFields
property now properly differentiates between a truly missing from JSON field and field, that contains null, which is turned into NSNull.null instance by NSJSONSerialization.mapKeyPath:toPoperty:withDateFormatter
method now creates blocks, that return nil instead ofNSNull
if received value is not a NSString or NSDate.NSNull
instance however is left untouched.
- Added ability to ignore field during serialization - #148(thanks, @vladimirbebeshko)
- Improved types of arrays - #145(thanks, @Uncommon)
- EKRelationshipMapping has been made public for iOS target - #147(thanks, @dvs15)
- Fixed Xcode 8.3 warning in imports.
This release requires iOS 8 / macOS 10.9 / tvOS 9.0 / watchOS 2.0 and higher.
- API was annotated with lightweight Objective-c generics and nullability annotations to be better imported in Swift.
- All relationship mappings, like
hasOne:forKeyPath:
, now returnEKRelationshipMapping
instead of void, and allow mapping customization via condition property. - It's now possible to switch mappings based on passed representation, like so:
EKRelationshipMapping * relationship = [mapping hasMany:Dog.class forKeyPath:@"animals" forProperty:@"pets"];
relationship.mappingResolver = ^EKObjectMapping *(id representation){
if ([representation[@"type"] isEqualToString:@"dog"]) {
return [Dog objectMapping];
} else {
return [Wolf objectMapping];
}
};
EKObjectMapping
hasOneMappings
andhasManyMappings
are now arrays instead of being dictionaries.EKRelationshipMapping
now hasmappingResolver
andserializationResolver
properties instead ofobjectClass
property ofEKMappingProtocol
typeNSDateFormatter
extension withek_dateFormatterForCurrentThread
is removed.
- Crash, that happened when
EKCoreDataImporter
tried to import Swift NSManagedObject subclass, that did not have primaryKeyMapping, which led to calling valueForKeyPath method with nil.
- All API was annotated for nullability, allowing better interoperability with Swift
- Added
mapPropertiesFromUnderscoreToCamelCase:
method onEKObjectMapping
, that allows mapping underscored JSON keypaths to camel-cased properties.
For example:
[mapping mapPropertiesFromUnderscoreToCamelCase:@[@"created_at",@"car_id"]];
will map created_at
and car_id
keypaths to createdAt
and carId
properties in your model.
- When using
mapKeyPath:toProperty:withValueBlock:
method andignoreMissingFields
property onEKObjectMapping
is set toYES
, value block will no longer be called, if value in JSON is nil
NSDateFormatter
extension withek_formatterForCurrentThread
is deprecated and slated to be removed in release for Xcode 8, which drops support for iOS 7 and lower. This property is no longer useful, becauseNSDateFormatter
is thread safe from iOS 7 and higher, and there's no reason to storeNSDateFormatter
in thread dictionary anymore.
Following deprecated methods were removed:
serializedObject
onEKManagedObjectModel
. UseserializedObjectInContext:
instead.mapKeyPath:toProperty:withDateFormat:
method onEKObjectMapping
. UsemapKeyPath:toProperty:withDateFormatter:
method instead.