mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Sharing data with a widget extension #351
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gardyna on GitHub (Nov 17, 2020).
I'm creating a widget to acompany my app but it seems like that the extension does not speak to the same DB as the app instance. is there any guide to setting the app group or something so that I can set the data in app for the widget extension to read?
@JohnEstropia commented on GitHub (Nov 18, 2020):
I'm planning to fully support this feature in a future release, but for now you should still be able to do this by manually managing your app-group's folder and passing it to
SQLiteStore.init(fileURL:...). Something likeDo note that even if this does work, PersistentHistoryTracking is currently not implemented in CoreStore, so if you need real-time change observation you will need to implement that on your own. (ref: https://www.avanderlee.com/swift/core-data-app-extension-data-sharing/) If you decide to do so, CoreStore does have a
DataStack.refreshAndMergeAllObjects()method you can use to force refetching on all objects.@gardyna commented on GitHub (Nov 18, 2020):
Thanks for that! I was unsure how to solve this particular issue but that worked like a charm
@JohnEstropia commented on GitHub (Nov 18, 2020):
@gardyna Glad it worked! I'm keeping this ticket open as a feature-request ticket, and so that others who have the same question may find it
@imrobbyrc commented on GitHub (Jul 3, 2024):
maybe can you implement this tickets? as i need this to in my notification extension