wwdc20-10184

RSS for tag

Discuss WWDC20 Session 10184 - Synchronize health data with HealthKit

Posts under wwdc20-10184 tag

3 results found
Sort by:
Post not yet marked as solved
95 Views

Smoothwalker Network

Hi everyone, I'm looking for help understanding the structure of the Smoothwalker HealthKit demo from WWDC2020. I'm an experienced coder but I'm fairly new to swift + HealthKit. Long story short: I'm creating an app that will draw Health data from HealthKit (e.g. steps, distanceWalked) and push the data to an external server/ database. From there I'll be performing analytics to give my users recommendations about their activity. The MobilityChartDataViewController page is a huge help - it demonstrates the use of an HKAnchoredObjectQuery - HKStatisticsCollectionQuery to generate only any updated statistics to push to the 'Network' for efficiency purposes. This is exactly how I'd like my app to behave, but I need help working out what 'Network' is at present in this demo, and how I can replace it with my own external server. I can't work out where the insane of the 'Network' class is being initialised, or really where the data is being pushed to at present. The demo gives console lines like: Pushing 1 new samples to server! Samples: ["HKQuantityTypeIdentifierStepCount": 1] This sounds great, but where is it going? I imagine its being stored locally at present, but I'd love to hear how is best to move it external. Many thanks for your help!
Asked Last updated
.
Post not yet marked as solved
128 Views

How to create new (custom) types specific for my app in HealthKit

I'm finding that there are a select few quantity types. How should I go about creating new custom types for use in my App. Let's look at an example. In your documentation HKQuantityTypeIdentifier has 10 types for Lab & Test Results (while it has 39 types for Nutrition). Let's look at a typical Lipid Blood Panel result from a typical blood test. I'd like to create data types for: Cholesterol 208 MG/DL Triglycerides 112 MG/DL HDL Cholesterol 52 MG/DL Calc LDL Cholesterol 134 MG/DL And also recoded the typical Risk Ratio of Cholesterol (LDL/HDL) in this specific lab result (134/52 = 2.58). How would I create these HKQuantitySample subclasses? the docs say: Extend Quantity Samples Like many HealthKit classes, you should not subclass the HKQuantitySample class. You may extend this class by adding metadata with custom keys to save related data used by your app.  For more information, see init(type:quantity:start:end:metadata:). Yet looking at that init doc - I don't see any info on creating new types and therefor new sample types.
Asked Last updated
.