How to safely unwrap optionals in Swift with if-let and guard statements | Bootcamp #47

Описание к видео How to safely unwrap optionals in Swift with if-let and guard statements | Bootcamp #47

In almost every application there are cases where you will declare variables as optional. In Swift we declare a value as optional be using the ?. When we do this, we are telling Xcode that this variable has the potential to be nil (or without a value). Therefore, when we go to use that variable in our code, we need to safely check whether or not it really has a value at that time. Two of the smartest and safest ways to safely "unwrap" these optionals is be using 'if let' and 'guard' statements. In this video we will learn both! It should be noted that both of these methods are MUCH safer than explicitly unwrapping optionals by using the ! symbol (avoid this!).

Next video:    • How to add a Tap Gesture in SwiftUI |...  
Last video:    • How to use onAppear and onDisappear i...  

🤙 WELCOME BACK 🤙

WEBSITE: https://www.swiftful-thinking.com

DISCORD:   / discord  

GITHUB: https://github.com/SwiftfulThinking/

SAY THANKS: https://www.buymeacoffee.com/nicksarno

Комментарии

Информация по комментариям в разработке