UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

DAY 12

Optionals


Null references – literally when a variable has no value – were invented by Tony Hoare way back in 1965. When asked about it in retrospect, he said “I call it my billion-dollar mistake” because they lead to so many problems.

This is the last day that you’ll be learning the fundamentals of Swift, and it’s devoted exclusively to Swift’s solution to null references, known as optionals. These are a really important language feature, but they can hurt your brain a little – don’t feel bad if you need to repeat some videos a few times.

Today you have 11 one-minute videos to watch, and you’ll meet unwrapping, optional chaining, typecasting, and more. Once you’ve watched each video and completed any optional extra reading you wanted, there’s a short test to help make sure you’ve understood what was taught.

  1. Handling missing data
  2. Unwrapping optionals
  3. Unwrapping with guard
  4. Force unwrapping
  5. Implicitly unwrapped optionals
  6. Nil coalescing
  7. Optional chaining
  8. Optional try
  9. Failable initializers
  10. Typecasting
  11. Optionals summary

Have some questions about optionals?

Hit Send below to start a virtual conversation with me.

Need help? Tweet me @twostraws!

 

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

100 Days of Swift


The 100 Days of Swift is a free collection of videos, tutorials, tests, and more to help you learn Swift faster. Click here to learn more, or watch the video below.

Back to 100 Days of Swift

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.