Apple Health Frameworks

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

Part 2: Dive Into More Details

05. Use OCKTask & ORKTask

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 04. Learn More About CareKit Next episode: 06. Learn More About ResearchKit

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.

Transcript: 05. Use OCKTask & ORKTask

Part 2, Episode 07, Learn about OCKTask and ORKTask

In this episode, I want to show you how to use OCKTask and ORKTask. Let’s jump back to the project that you made on episode 3.

From the project navigator under the ViewModels folder, open TaskManager class; here, as you can see, you made an OCKTask.

As you should know by now, OCKTask is part of the CareKit Framework. So let’s jump to the apple documentation to see what this does!

An OCKTask represents some task or action that a patient is supposed to perform. Tasks are optionally associable with an OCKCarePlan and must have a unique id and schedule. The schedule determines when and how often the task should be performed, and the impactsAdherence flag may be used to specify whether or not the patient’s adherence to this task will affect their daily completion rings.

So go back and see what you’ve done; you made an OCKSchedule first and then assigned it to an OCKTask.

From the project navigator under the ViewModels folder, open SurveyManager class; here, you can see you made an ORKTask as an output of the onboardingSurvey function.

Next is to know what’s ORKTask; ORKTask is the actual survey you show to the user; let’s jump to the apple documentation to see what this does!

The ORKTask protocol defines a task to be carried out by a participant in a research study. Implement this protocol to enable dynamic selection of the steps for a given task. By default, ORKOrderedTask implements this protocol for simple sequential tasks. Each step (ORKStep) in a task roughly corresponds to one screen and represents the primary unit of work in any task presented by a task view controller. So go back and see what you’ve done; you made an ORKOrderedTask and then added different steps.