Introduction to Swift: Optional chaining

preview_player
Показать описание
Learn how to simplify your code by calling multiple optional methods in a single line of code.

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

Questions? Comments? Tweet me @twostraws.

twostraws
Автор

Very clear explanation + example as always. Not sure why you don't have more subscribers + likes.

semilife
Автор

This makes perfect sense. Thanks for making this video.

cristianm.
Автор

Isn't it true that we are going to use optional chaining only on a type of data that has properties or multiple levels of properties such as class or structs? So why you didn't use struct or class? According to this video optional chaining is just putting the question mark on something that have optional value. Furthermore, nil coalescing is the same but it has 2 question marks.

jurobebic
Автор

This worked better for me and got rid of all the warnings on Jetbrains AppCode


// Example of "optional chaining"
let album:String? = AlbumReleased(in: 1996)?.uppercased()
print("The album is: [ \(album ?? "?") ]")

alias_onedepapel