Open ManueGE opened 5 years ago
Interesting, I saw that we already discussed this 3 years ago: #48
I had forgotten the category I mentioned there, anyway I think that it is something useful for the project.
Just for clarification, let me explain a real-world use case of this.
In my app, my entities have a few computed var that is calculated once and cached. On each update, I want to clean up the cache, so those properties are calculated again. With this solution, I could do it easily, instead of calling cleanCache
every time I complete an update operation.
Hello!
After using Groot for years I found a small improvement. Could we add a way to modify an object after it is parsed with Groot? Let me explain.
Let's say I have these entities:
I would like to set the
importedFromServer
totrue
after every Groot import. I know that currently I can do it this way:This is quite easy, but it the thing I import is a user, I need to do:
And if I import a Department:
It would be great if we can do it in a single place.
My proposal for doing it is creating a
NSManagedObject
extension with a single empty method:and call it after an object is inserted.
This way any
NSManagedObject
subclass can override this method and do their own stuff there. In our example, we can add this method toRole
:I can prepare a PR if you are willing to approve this feature.
Let me know your thoughts.
Thanks.