Apple Health Frameworks

Nov 29 2022 · Swift 5, iOS 15, Xcode 13

Part 2: Dive Into More Details

09. Work With StoreManager

Episode complete

Play next episode

About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 08. Create a CheckIn Task Next episode: 10. Make a Follow-Up Vaccination Task

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

Part 2, Episode 10, Work with StoreManager

In this episode, I want to show you how to work with CareKitStore using StoreManager. Until now, you had the StoreManager on the memory, which means every time you opened the app, it was empty, but from now on, I want to tell you how to store it on the disk, so you don’t need it to do the onboarding task again and again.

      type: .onDisk(protection: .none)
static func fetchTasks(on date: Date, storeManager: OCKSynchronizedStoreManager, completion: @escaping([OCKAnyTask]) -> Void) {
    var query = OCKTaskQuery(for: date)
    query.excludesTasksWithNoEvents = true
      query: query,
      callbackQueue: .main) { result in
      switch result {
      case .failure:
        Logger.task.error("Failed to fetch tasks for date \(date)")
      case let .success(tasks):
TaskViewModel.fetchTasks(on: date, storeManager: self.storeManager) { tasks in
            tasks.forEach {
              guard let id = TaskModel(rawValue: $ else { return }
              if id == TaskModel.checkIn {
                  input: id,
                  date: date,
                  storeManager: self.storeManager,
                  listViewController: listViewController,
                  delegate: self)