drewmccormack / ensembles

A synchronization framework for Core Data.
MIT License
1.63k stars 131 forks source link

Question: Ensembles and Extensions #195

Closed erndev closed 9 years ago

erndev commented 9 years ago

In Yosemite and iOS 8, we can now create extensions, which can share the app's core data store. For instance, and extension could create or modify an entity in the same core data store the app is using.

would this work with ensembles? AFAIK, it monitors the changes in the app's context, but i am not sure if it could detect changes done in the same store by an external process (the extension in this case).

Thanks

drewmccormack commented 9 years ago

Ensembles simply monitors the did-save notifications, so it will only work in the process where the save is made.

You could setup Ensembles in both the app and the extension. Even though they would be sharing the same store, I think that would all still work. And that way, it would capture all the saves.

How exactly do you handle saves from the extension? Your app context would need refreshing. Do you reset and reload the data? Or do you somehow pass back the updated objects from the extension to the app?

erndev commented 9 years ago

I somehow thought that i would need to do all the setup steps (including leeching) in the extension. But i did not think about only setting up the ensemble without leeching just to insert the new object. i'll give it a try and see if i does works.

about refreshing the data, not sure about that yet, but my first option is to send some kind of "refresh" command via the host app's url scheme. In my particular use case, i would only need to reload a table view to make the new item visible.

thanks

drewmccormack commented 9 years ago

You would need to leech, because otherwise Ensembles will not register the change.

It does seem that if you are just creating one item in your extension, using Ensembles, or even Core Data, is probably overkill. I would just create a dictionary, and pass that back somehow, and import it in your main app.

Drew

On 21 Dec 2014, at 12:17, Ernesto García notifications@github.com wrote:

I somehow thought that i would need to do all the setup steps (including leeching) in the extension. But i did not think about only setting up the ensemble without leeching just to insert the new object. i'll give it a try and see if i does works.

about refreshing the data, not sure about that yet, but my first option is to send some kind of "refresh" command via the host app's url scheme. In my particular use case, i would only need to reload a table view to make the new item visible.

thanks

— Reply to this email directly or view it on GitHub https://github.com/drewmccormack/ensembles/issues/195#issuecomment-67767153.

drewmccormack commented 9 years ago

resolve

On 21 Dec 2014, at 12:22, Drew McCormack drewmccormack@mac.com wrote:

You would need to leech, because otherwise Ensembles will not register the change.

It does seem that if you are just creating one item in your extension, using Ensembles, or even Core Data, is probably overkill. I would just create a dictionary, and pass that back somehow, and import it in your main app.

Drew

On 21 Dec 2014, at 12:17, Ernesto García <notifications@github.com mailto:notifications@github.com> wrote:

I somehow thought that i would need to do all the setup steps (including leeching) in the extension. But i did not think about only setting up the ensemble without leeching just to insert the new object. i'll give it a try and see if i does works.

about refreshing the data, not sure about that yet, but my first option is to send some kind of "refresh" command via the host app's url scheme. In my particular use case, i would only need to reload a table view to make the new item visible.

thanks

— Reply to this email directly or view it on GitHub https://github.com/drewmccormack/ensembles/issues/195#issuecomment-67767153.