Skip to content

Releases: lucasmedeirosleite/EasyMapping

0.12.0

01 Feb 19:03
Compare
Choose a tag to compare

Features

  • Added method mapKeyPath:toProperty:withDateFormatter:, that allows specifying NSDateFormatter to be used, when mapping strings to NSDate and reverse.
  • Added NSDateFormatter+EasyMappingAdditions category, that allows getting NSDateFormatter for current thread.
  • Added mapping blocks for converting NSString to NSURL and backwards

Deprecations

  • mapKeyPath:toProperty:withDateFormat: method is deprecated, please use mapKeyPath:toProperty:withDateFormatter: instead.

0.11.0

23 Jan 14:11
Compare
Choose a tag to compare

Features

  • Added support for incremental data for hasMany relationship(#81, thanks @baspellis)

0.10.0

18 Jan 14:33
Compare
Choose a tag to compare

Features

  • Added helper XCTest classes to test mappings(#80, thanks @ilyapuchka)

0.9.0

07 Jan 16:50
Compare
Choose a tag to compare

Features

This version introduces support for non-nested one-mapping, that allows breaking a single JSON dictionary into graph of objects. For example:

{
    "id":23,
    "name": "Lucas",
    "email": "lucastoc@gmail.com",
    "gender" : "male",
    "carId":3,
    "carModel":"i30",
    "carYear":"2013",
    "phones": null
}

What we want from mapping this JSON to objects is a Person object, that contains Car object inside. And Car object should contain carId,carModel and carYear properties. This release adds a new method to do that:

[mapping hasOne:[Car class] forDictionaryFromKeyPaths:@[@"carId",@"carModel",@"carYear"]
            forProperty:@"car" withObjectMapping:[Car objectMapping]];

This also works for serialization, object can be serialized into NSDictionary that we had earlier.

0.8.1

21 Dec 10:35
Compare
Choose a tag to compare

Bugfixes

  • Fixed issue, where primary key from representation would not be picked up by CoreDataImporter, if primary key uses mapping block(@baspellis)

0.8.0

07 Dec 14:30
Compare
Choose a tag to compare

Features

  • Added new mapping methods to allow create mappings separate from model class(@toolboxash)
  • Added EKSerializer methods to allow serializing CoreData objects with reverse mapping blocks.

0.7.0

01 Dec 21:31
Compare
Choose a tag to compare

Breaking changes

This release introduces new, refined syntax for mapping. Unfortunately, it is not backwards compatible. To make new features work, we needed to change how mapping system works. And while we did that, it was a good time to improve syntax a little bit.

  • Fields are gone! Every method, that contained field in its name, now reads property. Previously
[mapping mapFieldsFromArray:@[@"foo",@"bar"]];
[mapping mapFieldsFromDictionary:@{@"foo":@"bar"}];

Now:

[mapping mapPropertiesFromArray:@[@"foo",@"bar"]];
[mapping mapPropertiesFromDictionary:@{@"foo":@"bar"}];
  • mapKey methods are more clear about what they do
[mapping mapKey:@"foo" toField:@"bar"];

is now

[mapping mapKeyPath:@"foo" toProperty:@"bar"];
  • Relationship methods now use class directly instead of mapping object
[mapping hasOneMapping:[Phone objectMapping] forKey:@"foo"];

has become

[mapping hasOne:[Phone class] forKeyPath:@"foo"];
  • Managed mapping blocks now receive NSManagedObjectContext they operate to allow state changes in the database if needed

Features

  • Added support for recursive mappings, with any object graph you can imagine.
  • Added convenience base classes, EKObjectModel and EKManagedObjectModel, that can serve as a base class for your models.
  • Added EKMappingProtocol, that is used to define how mappings are provided. You can use it to implement mapping for classes, that don't inherit from EKObjectModel or EKManagedObjectModel.
  • Added partial support for Swift - read more about it here

Bugfixes

  • EKCoreDataImporter now caches inserted objects to prevent duplication