Day 26 Complete

2022-07-22 1 min read

Day 26 of the 100 Days of SwiftUI is a study session, the first part of project 4 which aims to build an app called BetterRest, which uses CreateML to help predict the best time to go to bed so you get enough sleep.

I spent most of my free time today actually completing the app from Day 25. I think the thing that challenged me the most was figuring out how to calculate whether the user got the answer correct or not. Upon initial inspection it seemed like one massive complicated if/else or switch statement would do the job, but I kept getting inconsistent results and the code was awful to look at and debug. A suggestion from lesson indicated that using an array (which is ordered) to indicate the correct answers was the way to go, and after some thought I managed to finally figure out how to do that with a simple if/else statement. I then figured out the scoring and tracking of the number of questions asked and then showed a final alert message.

I found the task sufficiently challenging and enjoyed the learning experience.