Apple Health Frameworks

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

Part 1: Essentials

02. Prepare a Project

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: 01. Learn About Apple Health Frameworks Next episode: 03. Add an Onboarding Task
Transcript: 02. Prepare a Project

Part 1, Episode 02, Make the project ready for HealthKit, CareKit, and ResearchKit.

In this episode, I want to show you how to add all of the Apple Health Frameworks as a dependency into your project.

Let’s begin with HealhKit; in the starter project, select the project from the project navigator and then open the MyVaccine Target and under the Frameworks, Libraries press Plus button and search for HealthKit, add it to the project, easy peasy.

Next step is to get a hold of SPM, here select the MyVaccine under the project section and navigate to Package Dependencies select plus and search for CareKit, Select branch for Dependency Rule and make sure you are on the main branch; next, add the package and choose CareKit and CareKitFHIR in the next step to add it to the project.

Isn’t it awesome? You just added 2 out of 3 dependencies; thanks to Apple for making our life easier with SPM.

Now we have the last strong one; since apple doesn’t support SPM for ResearchKit, we have to use the old school way of doing it, which is drag and drop :))

I’ve already added the ResearchKit as a subModule to the git; please make sure you have it before doing the next step, either download it directly from GitHub or check out the subModule and make sure that you are on the main branch.

Open the finder, and in the sample project folder under the external-resources folder, you can see there is a folder called ResearchKit; drag the ResearchKit.xcodeproj and drop it under the MyVaccine folder in the project navigator, Then open the project and select MyVaccine Target and under the Frameworks, Libraries press Plus button and search for ResearchKit and add it to the project. Build and run to see no error anymore and how the project builds with all these dependencies.