Introduction to Swift: Optionals

preview_player
Показать описание
This video explains optionals in three different ways. Once you understand them, skip ahead to 12:43!

Learn how to Swift deals with missing data, including unwrapping using “if let” and “guard let”.

Рекомендации по теме
Комментарии
Автор

Questions? Comments? Tweet me @twostraws.

twostraws
Автор

The explanation that made me get it: when a function returns an optional, it hands you a box. What you want is—maybe—inside the box. So you have to unwrap the box to see if there's a kitten inside. Because, cruelly, that function did not actually promise you a kitten. It said it could also return an empty box.

DeirdreSM
Автор

I found this extremely helpful in understanding optionals. -- Very clear and organized explanations!

jdholwick
Автор

What do we do if we're trying to unwrap the optional and it's actually nil?

danielthompson
Автор

Great explanation of an often misunderstood (Taylor) Swift concept.

semilife
Автор

Excellent explanation Paul. Thanks a lot!

jasurrajabov
Автор

If I had a text field, I would then need to check if it contains a value before I force-unwrap it and use it for my purposes?

bitsurfer
Автор

Thank you Paul! The Taylor Swift album example was the one that made it click for me. Very straightforward and easy to grasp.

kelly_browning
Автор

Didn`t get any of the explanations. Programming might not be for me!

salinas
Автор

Did anyone notice the message that the LLDB RPC server crashed? Looks like LLDB didn’t unwrap the optional - so sad. 😫

williamsquires
Автор

How do you open Playground? I've used it but forget how to open it.

bitsurfer
Автор

Great explanation. Now I get it. Thank you!

reinioyeah
Автор

You really like Taylor Swift...🤣 I get the pun.haha

alias_onedepapel
Автор

haaaa, I am hater of Taylor Shift, ahaha...

func hateTaylor() -> String {
print("I am not a hater of Taylor Swift")

}

lagustephen