How to accept functions as parameters – Swift for Complete Beginners

preview_player
Показать описание
Other videos in the Closures section:

3. How to accept functions as parameters: This video

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

Tip I learned today after some searching. When the auto complete menu is open hit the "return" key on your keyboard twice to automatically convert to trailing closure syntax! Saves so much time when you have a function that accepts multiple closures!

nicjrichdev
Автор

Awesome !! This is super helpful . I struggle with closures a lot ! :)

bidishabiswas
Автор

It’s clear now. The last example helped me to understand how things are basically flowing.

vp
Автор

Fully understood everything. However, why on the second example we didn't used "using". I modified the first example removing the using and still works. Any reason on why and when use "using"?

josecaldev
Автор

When I run the function:

func generateNumber() -> Int {
Int.random(in: 1...20)
}

let newRolls = makeArray(size: 50, using: generateNumber)
print(newRolls)

I get an error saying Cannot find 'makeArray' in scope. Has Swift made some kind of update to variable declarations after this video was published?

Oneweirdperson-gi
Автор

I work in cyber security, and today was the first day that the word 'hacking' in 'hacking with SwiftUI' really clicked. I got a similar feeling as when discovering a vulnerability during a security assessment. It's really just a matter of figuring out how stuff works and make the code do things you want it to. Loved this course.

reneonyt
Автор

We don't have to use the word "using" here.

hamdymubarak
Автор

hi paul. remember how your dad sat us down and told us the path we were heading on would make us jail birds?
and then we made a life choice, with you on swift and me on java.

look at you. how as swift been treating you these 19.3 years? I bet you choose my direct, and did java and her beans the way i did.
at leaste we are not jail birds, thanks to your dads words.

alexpascal
join shbcf.ru