developing apps with healthkit - lunarlincoln · with healthkit – jonathan wiley (@microchip128)...
TRANSCRIPT
![Page 1: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/1.jpg)
An Apple a Day: DEVELOPING APPS WITH HEALTHKIT
– Jonathan Wiley (@microchip128) 5.25.2016
![Page 2: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/2.jpg)
INTRODUCING
HealthKit
![Page 3: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/3.jpg)
What is HealthKit?Nashville CocoaHeads - HealthKit
![Page 4: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/4.jpg)
What can HealthKit store?• HEALTH SAMPLE DATA
• Body Measurements, such as weight • Fitness Measurements, such as active energy burned exercising,
walking & running distance, exercise minutes • Nutrition, such as fiber or caffeine • Sleep Analysis • Vitals, such as heart rate
• USER HEALTH CHARACTERISTIC DATA • Things that don’t change for a user, like birthdate and blood type
Nashville CocoaHeads - HealthKit
![Page 5: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/5.jpg)
What apps use HealthKit?
Nashville CocoaHeads - HealthKit
HeartBeat
![Page 6: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/6.jpg)
App Store ConsiderationsNashville CocoaHeads - HealthKit
![Page 7: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/7.jpg)
How do you code for HealthKit?
![Page 8: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/8.jpg)
Getting Started: HealthKit Permissions
Nashville CocoaHeads - HealthKit
You must request read/write permission for each HealthKit type from a user
![Page 9: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/9.jpg)
Getting Permissions in HeartBeat App CodeNashville CocoaHeads - HealthKit
TO THE CODE!
![Page 10: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/10.jpg)
How do you read from HealthKit?Nashville CocoaHeads - HealthKit
Direct method calls for characteristic data, such as dateOfBirthWithError:
For sample data • Statistics query • Statistics collection query • Correlation query • Source query • Activity summary query
![Page 11: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/11.jpg)
HealthKit Objects describe values in HealthKitNashville CocoaHeads - HealthKit
UUID Metadata Source Revision Device
Samples have additional properties • Type • Start Date • End Date
![Page 12: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/12.jpg)
Units and QuantitiesNashville CocoaHeads - HealthKit
HKUnit is extremely powerful for converting readings into the proper unit
For instance, getting weight in pounds or grams can be done using HKUnit
![Page 13: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/13.jpg)
Reading Age in HeartBeat App CodeNashville CocoaHeads - HealthKit
TO THE CODE!
![Page 14: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/14.jpg)
How do you stream data from HealthKit?Nashville CocoaHeads - HealthKit
• Observer query • Anchored object queries • Statistics collection query • Activity summary query
![Page 15: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/15.jpg)
Streaming Heart Rate QueryNashville CocoaHeads - HealthKit
TO THE CODE!
![Page 16: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/16.jpg)
How do you write to HealthKit?Nashville CocoaHeads - HealthKit
• Get the HKObjectType for the sample you want to record
• Create a HKSample object for your sample with the sample values
• Save the object to the HealthKit store
![Page 17: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/17.jpg)
Saving Workout CodeNashville CocoaHeads - HealthKit
TO THE CODE!
![Page 18: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/18.jpg)
DEMO TIME HeartBeat App
![Page 19: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/19.jpg)
Use the Apple Watch to monitor heart rate more frequently with HKWorkoutSession
Nashville CocoaHeads - HealthKit
• Can start a type of workout and the Apple Watch will record accordingly
![Page 20: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/20.jpg)
HKWorkoutSession CodeNashville CocoaHeads - HealthKit
TO THE CODE!
![Page 21: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/21.jpg)
Syncing HealthKit from the Apple WatchNashville CocoaHeads - HealthKit
• Takes a while • Use Watch Connectivity
to update iOS UI from HealthKit readings on the watch
![Page 22: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/22.jpg)
DEMO TIME GET ON THE BIKE
![Page 23: DEVELOPING APPS WITH HEALTHKIT - LunarLincoln · WITH HEALTHKIT – Jonathan Wiley (@microchip128) 5.25.2016. INTRODUCING HealthKit. What is HealthKit? Nashville CocoaHeads - HealthKit](https://reader033.vdocuments.mx/reader033/viewer/2022060522/60513147a5bc231ff421df64/html5/thumbnails/23.jpg)
Questions?
@LunarLincoln | www.LunarLincoln.com