I have an app that uses Core Data + CloudKit stack. (Core Data syncs between devices.). Now I want to display data from Core Data in iOS 14 widget (view in WidgetKit target).
My goal is to have data in widget also be actual data from Core Data: i.e. — user changed record on device A, and little later on device B (with widget) changes represented in widget.
How should I do it:
a) Add App Group capability for main app target and widget target; and fetch Core Data in widget target.
b) Fetch Core Data in main app target, save to file (plist?, JSON?) and later use that file in widget.
c) Fetch Core Data in main app target, get that data from widget target. (Is it possible?)
What is the most reasonable way? Thanks for any suggestions.