Christopher's HealthKit App Challenge Journal

Trends View

Since my last entry, I’ve been slowly chipping away at this new view while keeping up with my college classes.

The goal of this view is to show your consumption data graphically and how it changes over time.

The Trends View does replace the Data Logs View from the earlier versions of the app.

For each drink type, you will see an up or down arrow or a line. This represents if your consumption is trending up or down over the last 3 months. For this to display, 3 months have to pass from the first entry of the selected drink type. So you’ll eventually see something like in the image to the right.

From there, you’ll see a graph with your data along with the average or total. As you might have noticed this view was very much inspired by the Apple Health app. Now data can also be viewed by month, 6-months, and year.

When you tap any of the bars, you’ll get more specific information. If you tap on the background or the same bar, the highlight will go away.

You might be wondering how you change the day/week/month/6-month/year. That’s where swipe gestures come in. Just like in the Intake View, you can’t go to a future date/week/month.

To do this I made numerous new functions in my View Model and a new DataItem model. I also unintentionally made two loops that never end, so that’s cool.

Then there’s the “View All Data” button. As the name suggests, you will be able to see each data point for each day. This replaces the function of the Data Logs View.

Like all the other views throughout the app, optimizations have been made for Smaller Screens, Dynamic Type, High Contrast Colors, Grayscale, and VoiceOver. Here’s the chart on an iPod touch.

For VoiceOver, how exactly do you represent a visual aid auditorily? I decided to use iOS 15’s Audio Graphs. For an understanding of what this is, I’d recommend watching this from 1:31 for a demo: Bring accessibility to charts in your app - WWDC21 - Videos - Apple Developer

While I have implemented this using this tutorial, I don’t know if it works since I get this when trying to activate it through the Simulator: [AXRuntimeCommon] Unknown client: Liquidus. I don’t know if this is a limitation of the Simulator or if I messed something up.

I do want to implement this as a Widget (in some form or another) so that’s my next goal for this. I’m expecting this widget to be a bit more challenging as I don’t have a static list of options like I did before.

1 Like