Swift Implicit Return - What's behind SwiftUI? - Following Swift Evolution

preview_player
Показать описание
In this Following #Swift Evolution video we take a look at a new Swift 5.1 feature and what makes the body function of your #SwiftUI views short and nice, no need for a return!

Implicit returns from single-expression functions

————————————————————­———————————

Photo by Ross Parmly on Unsplash
Рекомендации по теме
Комментарии
Автор

Thanks for discussing this! I'm an intermediate programmer learning iOS Swift programming right now and was a bit confused when I saw the SwiftUI demos. Finally someone who explains what's happening!

emillindholmbrandt
Автор

Love Your Videos, Awesome man, Please add some advance topics like your KeyPath Video which i feel is one of the best i have seen. Love From India

mukulbakshi
Автор

Wikipedia about syntactic sugar:
> syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for human use: things can be expressed more clearly, more concisely

You implicitly say it in the video, but:
The lack of the `return` keyword here is nice.. for seasoned developers. Removing explicit keywords from the codebase makes it harder to take junior developers onboard.
In relation to the definition above, it makes things "easier to express", and "expressed more concisely", but not "easier ro read" nor "expressed more clearly".

PierreEspenan