Swift Day 20 – Fireworks!!
Swift Day 20 – Challenge
- Create a firework emitter
- Make it explode where ever you touch the screen
Note: In the video it mentions me forcing the first touch. This means you place an exclamation mark (!) at the end of the object you are forcing to unwrap.
Unwrapping an object by force is also using the exclamation point.
For e.g. first!
When you unwrap something you are saying to the compiler that you know there will be something there.
It is not the best thing to do in programming as the object might not be there and the program will crash therefore you should use guard and if let statements to protect your program.
I’ll explain to you in more detail on guard and if let when I break free from my kids! 🙂
Like and Subscribe for more videos.
#Swiftprogramming, #100daysofswift, #swifttutorials, #swiftlang
Please Like and Subscribe the video. 🙂