Posts

Post not yet marked as solved
11 Replies
I might have answered my own question. First, add a managedObject variable to the TimelineProvider and a initializer: struct Provider: IntentTimelineProvider {     var managedObjectContext : NSManagedObjectContext     init(context : NSManagedObjectContext) {         self.managedObjectContext = context     } ... Then initialize the persistentContainer within the Widget struct and pass the persistentContainer.viewContext into the new Provider initializer: struct Widget_Extension: Widget {     private let kind: String = "Widget_Extension"     public var body: some WidgetConfiguration {         IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, provider: Provider(context: persistentContainer.viewContext), placeholder: PlaceholderView()) { entry in             Widget_ExtensionEntryView(entry: entry)         }         .configurationDisplayName("My Widget")         .description("This is an example widget.")     }     var persistentContainer: NSPersistentCloudKitContainer = {...         return container     }() The Provider now has access to your CoreData+CloudKit data.