I've paid for the "best" content in Udemy and nobody explains like you It's amazing that content like this is free
@StewartLynch
5 ай бұрын
I am glad you are finding it useful
@christophgeisel9708
Жыл бұрын
I have been struggling to understand Closures and tried all kinds of reading materials and tutorials to no avail. This tutorial was simply amazing and if it’s any further indication of the teaching style, why did I not find you sooner 😆
@StewartLynch
Жыл бұрын
I guess I have to improve my advertising :).
@benyaminabediyan5451
2 ай бұрын
Usually I don't write any comments but thank you Stewart; you helped me understand this damn concept. Really appreciate your work. hope you would start making a full fledged course on Swift and SwiftUI.
@spacemeter3001
2 жыл бұрын
This video is worth GOLD. Struggled to understand the syntax of closures and how they're used but now I understand it thanks to your examples!
@StewartLynch
2 жыл бұрын
Thanks. That is what I set out to do. Appreciate the feedback.
@medicaldoctoronyoutube
2 жыл бұрын
Thanks a lot for your video. Perhaps the best I've seen on this topic. Watching your videos from Russia, Moscow.
@Landon_Hughes
3 жыл бұрын
Closures are definitely one of the more confusing topics in Swift; this video explains them perfectly!
@pifeeder9027
2 жыл бұрын
Best explanation on closures I have ever seen
@sawjaixx711
3 жыл бұрын
THANK YOU!!! Your detail explanation helped solve my confusion.
@StewartLynch
3 жыл бұрын
Great. Glad it could clarify for you.
@mhfs61
3 жыл бұрын
As always, very educational Stewart. No voodoo, just calm and clear explanation. 👍🏼👍🏼👍🏼
@joshuashires
3 жыл бұрын
Epic once again Stewart. I have read the documentation over and over about closures and struggled to grasp the “Why” but comparing them to how we would usually write functions really really helped. A great follow on to this video would be expanding on the “Why?”. Your explanation using the VStack example was a big “Ohhhh i get it” moment but it would be good to see more examples of why should we use closures with real world examples. The thing I find hard is looking at a problem and implementing closures because doing it with functions in the traditional way just makes more sense and I cant see the advantage to using closures. However your completion handlers video might help with implementation of closures. Keep up the good work! Thank you for your contribution.
@samuelpatrickhenness
3 жыл бұрын
Thanks Stewart, another really useful video. its great to finally understand how things I've been doing for a while actually work!
@StewartLynch
3 жыл бұрын
Glad it helped! That is exactly what I am trying to achieve with my videos. My rule now is to not use anything that I do not understand myself.
@eyupmert7338
8 ай бұрын
Amazing. I really can't say anything else. I was struggling with closures, it's hard to understand because it's hard to explain I guess 😅 But you found a great way to explain the topic. Incrementing the level of knowledge slowly with different examples. And showing behind the scenes slowly. That's it! 👏
@StewartLynch
8 ай бұрын
Glad it helped!
@toluojo6141
3 жыл бұрын
You are the best. Can't believe how much I've learned so far from you. Thanks a million
@StewartLynch
3 жыл бұрын
Happy to hear that!
@absar66
Жыл бұрын
This is called quality tutorial with calm instructions...many thanks 👍
@FRkiddo
Жыл бұрын
this is great, your style of explaining is really good
@cristhianleon2228
3 жыл бұрын
What a clear and detailed explanation, especially with the capturing values. Thanks!
@baylorjaxton5199
3 жыл бұрын
sorry to be offtopic but does any of you know a tool to log back into an instagram account? I was stupid forgot my password. I would appreciate any help you can offer me!
@judsonbrendan657
3 жыл бұрын
@Baylor Jaxton instablaster =)
@baylorjaxton5199
3 жыл бұрын
@Judson Brendan Thanks so much for your reply. I found the site thru google and Im trying it out atm. I see it takes quite some time so I will get back to you later when my account password hopefully is recovered.
@baylorjaxton5199
3 жыл бұрын
@Judson Brendan it did the trick and I finally got access to my account again. Im so happy:D Thanks so much, you really help me out :D
@judsonbrendan657
3 жыл бұрын
@Baylor Jaxton no problem xD
@abhiireddy6
3 жыл бұрын
one of the bestest lectures i have ever listened.. thank you very much
@jasurrajabov
3 жыл бұрын
Tutorials are one of the best, with both high-quality video edit and the content itself very informative. Also love to see tutorials using closures with using weak, unowned. Thank you very much.
@semilife
3 жыл бұрын
Thanks Stewart un-voodooing the Voodoo. Clear simple, concise.
@StewartLynch
3 жыл бұрын
Glad you found it helpful
@davidspicer8053
3 жыл бұрын
Certainly the absolute best video on closures i've ever seen!
@StewartLynch
3 жыл бұрын
Thanks for that David. Glad you liked it.
@edwarmartinez228
2 жыл бұрын
Thank you Stewart, you are Really a teacher
@jaaviondavis9790
3 жыл бұрын
Thank you so much! I was struggling to figure out the meaning, the syntax, the use cases of closures in swift. After watching the video I'm able to logically think it out as a code and not stray away from the context. Please upload more videos because the way you explain concepts and your thought process is impeccable. I will definitely subscribe.
@StewartLynch
3 жыл бұрын
I am approaching 150 videos now so I will continue. Enjoy.
@jaaviondavis9790
3 жыл бұрын
@@StewartLynch Do you have any videos explaining protocols and delegates?
@StewartLynch
3 жыл бұрын
I don’t think so. I seldom use them now with SwiftUI as there are alternate ways. I prefer to pass closures.
@headach09
Жыл бұрын
Lots of cases comparing !! Much thanks :)
@AchrafTrabelsiMobileDeveloper
2 жыл бұрын
Thank your for this amazing video about closure, very helpful !
@3luizcunha
3 жыл бұрын
Always incredible videos, thank you very much Stewart
@StewartLynch
3 жыл бұрын
Thanks
@rolandolahmusic
2 жыл бұрын
Fantastic explanation!
@ribosome8085
2 жыл бұрын
Steward is awesome 👏 thank you so much!
@shadieossei4336
3 жыл бұрын
Great job explaining! I'm beginning to understand closures a little bit.
@leneil46
Жыл бұрын
Wow this video helped me out so much! Thank you.
@marcaupont9145
3 жыл бұрын
Great job Stewart! Very thorough explanations!
@StewartLynch
3 жыл бұрын
Thanks Marc. This means a great deal coming from you,.
@DavidKoontz
2 жыл бұрын
Thanks that was a great explanation.
@Александра-ш8ж1б
3 жыл бұрын
I admire you! Thank you for such a detailed and simple explanation.
@shreesharao8308
2 жыл бұрын
Best Explanation..It was helpful... Keep it up :)
@daniel_munoz_r
3 жыл бұрын
Thank you very much for this video.
@KimbrellBrad
3 жыл бұрын
That @escaping example really made me understand what is happening in these cases! Never really go it until now. Thanks Stewart! Oh, I have to ask...who does your cover art for these videos? They are really entertaining and have a lot of thought behind them! Bravo! BTW, I think it is you, your significant other, or a good friend. This much detail would likely be expensive!)
@StewartLynch
3 жыл бұрын
I use a free app called Bitmoji Brad. Available on the App Store. You design your own avatar and then it provides you with hundreds of scenes that you can pick from. Anyone can do it. Other KZitem content providers use it as well.
@Simon-ro8nh
3 жыл бұрын
What a great video! This is super helpful! Thank you Stewart!
@lautarob
9 ай бұрын
Hello, enlighten videos! Thanks subscribed!!
@kasunjayasekara3052
3 жыл бұрын
Thank you very much finally I understand it correctly :)
@StewartLynch
3 жыл бұрын
Glad I could help
@Aightbruh02
3 жыл бұрын
Please do a similar video about memory management and retain cycle
@drmucahiderdogan
3 жыл бұрын
Great video.
@abdulbasir8740
3 жыл бұрын
Such an amazing tutorial, Thanks a Billion.
@StewartLynch
3 жыл бұрын
You're very welcome!
@ravisaini8034
3 жыл бұрын
Thank you so much sir.
@ScottGrunwald
2 жыл бұрын
Thanks for the great video
@oneCrispy
Жыл бұрын
thank you.
@vamsi3877
3 жыл бұрын
Wow superb 👏
@doesntmatter6827
3 жыл бұрын
Amazing!
@1sudrap
3 жыл бұрын
Very nice and comprehensible video which really helped me to get a good grasp of this topic, but just a small remark: Why do you say "Declare variable" and actually declare a constant. You did it at least twice in this video. But anyway great job.
@StewartLynch
3 жыл бұрын
Yah, I make that mistake all the time and interchange variable and constant. I try to catch and correct those things, but as you can see, I am not always successful. I have a tendency like many others to use variables when constants will do just fine. I script my videos before I record the video and then add the audio later after recording. As I am building the video, I realize that a constant will be just fine and then forget to edit my script when I am recording the audio. I will try harder next time to catch these things.
@itchyminge
Жыл бұрын
Why do you call finallySayIt within the function, and then pass in a different function (closure) called reallySayIt? Could you not call finallySayIt within the sayHello function?
@StewartLynch
Жыл бұрын
I am not sure I understand your question. Feel free to email me if you want to explore this further.
@kenturnbull9679
3 жыл бұрын
This one??? I see Completion handlers as well. KT
@brandonwinston
3 жыл бұрын
How does it work that your “PublicFunctions” function takes a ()->Void but then we toss a bunch of different types of closures at it that are not ()->Void?
@StewartLynch
3 жыл бұрын
Perhaps this will clear it up. We can create a function that itself contains whatever code we want, including other functions. func example1() { func sayHello() { print("Hello") } sayHello() } Notice that example1() has no parameters and returns nothing so it is of type () -> Void We can then use that public "code" function to pass in example1 as our sampleCode because it meets the requirement for our closure. code(for: "Another Example", sampleCode: example1) Now, because sampeCode is a trailing closure, it could be written like this: code(for: "Another Example" { example1() } So instead of defining example1 as a function, we can simply pass in the body like this. code(for: "Another Example") { func sayHello() { print("Hello") } sayHello() } Does that help?
@brandonwinston
3 жыл бұрын
@@StewartLynch yes thank you very much!
@Sokrates8
3 жыл бұрын
Strangely I can't download the Starter Files with the Chrome Browser; always have to switch to safari.
@StewartLynch
3 жыл бұрын
Sounds like a security issue. It is a Zip file so that could be your issue.
@kenturnbull9679
3 жыл бұрын
@@StewartLynch I regularly use Chrome, Canary, and Firefox Dev. I can download the starter files in ALL of them as well as unzipping them. In fact, I just checked all of them before I commented. In addition to the Closure info, I really enjoyed seeing what things can be done with Playground... but my spelling is starting to suffer :-)
@tibettenballs4962
2 жыл бұрын
I understand how trailing closures work, but why are they so used in Swift-- rather than nesting functions or recursive method calls?
@tibettenballs4962
2 жыл бұрын
perhaps, its one of those weird "just do it" concepts Apple pushes, such as the "use structs over classes" paradigm.
@StewartLynch
2 жыл бұрын
I am not sure I understand. Perhaps if you could share an example? Also, completion handlers are often used for asynchronous actions so nesting functions or recursion may not be viable. WIth the new Swift Concurrency, however, we now have async/await that is replacing asynchronous closures.
@tibettenballs4962
2 жыл бұрын
@@StewartLynch @Stewart Lynch you actually answered my question with the async/await (did js a while back). i was thinking set up one function call to take the strings input (name) and then while in t he 1st function, pass the now uppercased String to another function (earmamrked as await) to run the print method or return .. im not sure if that makes sense, as this is what I would do in JS
@StewartLynch
2 жыл бұрын
@@tibettenballs4962 closures are is callbacks
@tibettenballs4962
2 жыл бұрын
@@StewartLynch understandable. even so, it very verbose, and i am curious why function/closure callbacks are used rather than function on function. perhaps Apple is somehow protecting the the end-user/OS? i just dont understand why closures are so overly used, while being obtuse in syntax. i mean (italics) its apple, right? -- why not keep it simple?
@nickapeed
Жыл бұрын
Great video here and your other work! I'm a new subscriber, thanks!! Question for anyone that can help me at 10:08 func sayHello(to name: String, finallySayIt: (String) -> ()) { what is the purpose of the "to" here?
@StewartLynch
Жыл бұрын
It is simply there to make the function more readable at the call site. sayHello to “xxxxxx” instead of sayHello “xxxxxx”
@mcquinmadtha
Жыл бұрын
"to" is the external parameter name, whereas "name" is the internal parameter name. So when passing a parameter, instead of saying sayHello name: "Sam", it would look like sayHello to "Sam", much more readable
@tibettenballs4962
2 жыл бұрын
its sad that youtube algo does not value good tutors. i see this way too often, to the point where i seek less views when learning new stacks.
@StewartLynch
2 жыл бұрын
Should I take this as a compliment?
@tibettenballs4962
2 жыл бұрын
@@StewartLynch for once, yes. Having learned java from books , school and YT, i'd conjecture you are top rate.
@mx.stoneheart
3 жыл бұрын
@14:00 calling me TF out
@StewartLynch
3 жыл бұрын
I think we have all been there.
@richoffks
3 жыл бұрын
bruh, I wasted two hours finding out this code doesnt even work smh
@StewartLynch
3 жыл бұрын
Pardon me? What are you referring to? It would help if you could be more specific, because the code does indeed work in this video.
@richoffks
3 жыл бұрын
@@StewartLynch when I create the exact same functions as the one in the video, an error pops up because of the incorrect parameter name
@StewartLynch
3 жыл бұрын
DM me on Twitter @StewartLynch and share your code with me so I can see what you are doing wrong.
@StewartLynch
3 жыл бұрын
I also just downloaded the completed playground from the link provided and all of the code works fine, even in Xcode 13 beta so you must be doing something wrong in your implementation. I am more than happy to check your code.
Пікірлер: 103