I'm looking for direction to better understand CareKit/CareKitStore in comparison with CoreData

88 views Asked by At

This is my first post here, but have been here many times - I always appreciate the help :) Also, I have Aspergers and am a literal person and sometimes miss things are more apparent to others.

I'm currently learning Swift UI in Xcode 14 and have been using some great resources like iOS Academy, Code with Chris, and WWDC Code Alongs...and have been filling in some of the missing piece with posts from here :) Currently, I am trying to understand how CareKitStore works in relation to CoreData.

For context, I have made some neat beginner apps via tutorials that use both CoreData (making a grocery list from iOS Academy, seen here for reference: https://www.youtube.com/watch?v=rjHBINtpKA8) and have done the WWDC 2022 videos tutorial/code along for CareKit and ResearchKit (3 Video Series, as seen here for reference: https://developer.apple.com/videos/play/wwdc2021/10068/).

As previously mentioned, I somewhat understand the premise that CareKitStore is built on CoreData and what I am having trouble with is understanding how CareKitStore stores the data in comparison to CoreData, like if I were to store data in a CoreData set through CareKit. For example, I am watching a different video, the WWDC 2020 video ("What's new in CareKit" seen here: https://developer.apple.com/videos/play/wwdc2020/10151/) and looking at this code:

`import CareKit

import CareKitStore

let coreDataStore = OCKStore(name: "core-data-store") let healthKitPassthroughStore=OCKHealthKitPassthroughStore(name: "hk-passthrough-store")

let coordinator = OCKStoreCoordinator() coordinator.attach(store: coreDataStore) coordinator.attach(eventStore: healthKitPassthroughStore)`

...does this correlate to a literal CoreData Entity named "core-data-store" the same way that the following code from the iOS Academy video does for "ToDoListItem":

let items = try context. fetch (ToDoListItem,fetchRequest())

In the WWDC 2020 video they don't show the setup of a CoreData base, Entities, etc. so I wasn't sure if it was just understood that Core Data was already set up and CareKitStore is storing them literally into a CoreData set (as seen in the iOS Academy example) or if it is doing something different, if so, what?!

If any of you can help provide any insight, could point me in the right direction here, or know of any tutorials I would be much appreciative!

Thank you!

0

There are 0 answers