gonzalezreal / Groot

From JSON to Core Data and back.
Other
534 stars 61 forks source link

Ability to modify objects after being imported using Groot #95

Closed ManueGE closed 3 years ago

ManueGE commented 5 years ago

The changes contained on this PR add the ability to modify an object after being inserted/update using Groot in a consistent way.

It just adds a category to NSManagedObject with the method grt_awakeFromInsert that is called after each insert/update operation. This method can be overridden by any subclass.

This is a possible solution for the issue described in #93 .

If you like the idea but you want me to change something let me know.

gonzalezreal commented 5 years ago

Hi @ManueGE,

Thanks for your contribution. It seems a useful feature to have. My concern with the implementation is the use of an extension, rather than a protocol. Is there any special reason you chose to do it that way?

ManueGE commented 5 years ago

No, there is not a reason for that. I also thought about adding it as a protocol, but I finally decided to do it as an extension. I can switch it to a protocol if it sounds better for you.

Any idea about the name of that protocol? Maybe GrootCustomInsertable and a method called postInsert?