Navigation View and Metrics Displays

Since my last blog update I’ve learned a lot. First and foremost, I was fortunate to have a few sit-down meetings with the CS professors to look at my code regarding HealthKit queries and the delivery of data from the Health Store. We’ve learned that, at least for heart rate, data is not regularly updated/written to the Health Store, making it difficult to grab an accurate current heart rate from a user. The difference between queries that come back with new data range anywhere from a minute or two to anywhere upwards of 20 minutes. As of right now, I am unaware of a way to force/request the heart rate to be updated.

To acknowledge this in my app, I’ve created a variable that keeps track of the current heart rate and stores its changes in an array of previous heart rates. This array, along with the time of the query at which it got new data, gets displayed on the “Your Health Data” page.

The LandingView file has a NavigationLink that allows the user to Navigate between the StatsView and StressTipsView.

Going forward I want to figure out how to add a breathing animation and also how to animate objects (such as a heart to replicate a heart beat). After that I might try to grab other data such as stand time.


Resources/tutorials I’ve been looking at:

Fetching latest HR (what the majority of my getLatestHR() fcn comes from)

Iterating through arrays (for loop in Swift):

Navigate between views (Navigation Link)

Heart Animation

HKActivitySummaryQuery (from Dr. McVey)

Leave a Reply

Your email address will not be published.

css.php