SwiftUI Day 6: Anyone say FizzBuzz?

Day 6 involved a lot of loop learning. As usual this was a case of ‘How to use them’ and ‘When to use them’ I really enjoyed this section but like last time, the checkpoint had me stumped.

The checkpoint was what is known as Fizz Buzz. The idea is that you’re printing numbers from 1-100. If your number is a multiple of 3 it prints “Fizz’ and if it’s a multiple of 5 it prints ‘Buzz’. Finally, if it’s both a multiple of 3 and 5 - you guessed it! It prints ‘FizzBuzz’

I managed to get the numbers sorted and managed to get the wording sorted but ended up with a situation where it was listing all the numbers and also the words (which were correctly placed but you’d see something such as 1, 2, 3 ,Fizz, instead of 1, 2, Fizz) after going over notes, I needed to get a hint and eventually got the result! Blimey, I almost felt like that came together there! - That was kind of addicting.

Swift UI Day 5: Learning conditions

Today was a longer lesson! Time to learn:

  • How to check if a condition is true

  • How to check multiple conditions

  • How to use switch statements to check multiple conditions

  • Finally, the ternary conditional operator

I now know things such as if, else, && and also || - who knew! Not me (and probably not me in 30 minutes because I absolutely need to re-read some of this! I’m getting used to commenting notes inside Xcode for reference. It’s allowing me to firstly, remember how to comment and also - it’s helpful for when the tasks come up! Future me should be thankful.
I feel like things so far are making sense but I absolutely have to follow a long - there’s no way I’m writing things from scratch. I have found myself pausing the video as much as I can and writing ahead which I managed to do for some of the image below!

SwiftUI Day 4: Second checkpoint and powering through

I was feeling confident today whilst I watched Day 4’s Hacking With SwiftUI video and read all optional reading. Boy, was I in for a slight wake up call. I watched the challenge video and if you didn’t know, hints are provided mid-way. I stopped and really gave it some thought. I got the first part nailed but I had to go back over previous lessons/literature and I was still pretty stumped. I then listened to the ‘hints’ and was still in the dark. I was reminded that I’m not meant to know all this yet, I’m learning. After more frustration and further reading - I got there. Well, Xcode isn’t shouting at me and I got an answer - We’ll count that as a result!