How to use escaping closures in Swift | Continued Learning #20

  Рет қаралды 20,356

Swiftful Thinking

Swiftful Thinking

Күн бұрын

Пікірлер: 46
@j1nMatt
@j1nMatt 3 жыл бұрын
Your tutorials are very practical compared to others, specially for people coming from other programming languages
@ashishprajapati825
@ashishprajapati825 2 жыл бұрын
Best explanation about escaping 🤩👏
@muhammadnasser2735
@muhammadnasser2735 3 жыл бұрын
i love you man you make the swiftUI so easy
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Haha Thanks Muhammad.. but it's not me. It's Apple that made SwiftUI so easy 😎
@EssaAlshammri
@EssaAlshammri 3 жыл бұрын
I’ve seen like 5 videos about escaping but this one sank in easily 👍 thanks
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Happy to hear that Essa! Thanks for watching.
@dariusdumitrescu
@dariusdumitrescu 2 жыл бұрын
Same journey for me. Thanks Nick!
@elemento_arts
@elemento_arts Жыл бұрын
lol.. love how you called "we went from this ugliness here" hahaha 🤣. Amazing tutorial as always Nick, Thanks!!
@paulmax9155
@paulmax9155 Жыл бұрын
... after 14 minutes we saw the first example of code with escaping 🥳
@BSharing09
@BSharing09 2 жыл бұрын
Well explained. Thank you so much.
@bobearl99
@bobearl99 2 жыл бұрын
I really felt like I got a handle on escaping for the first time, thanks very much for the clear explanation! Briefly included in here was an example of your approach to closures. I think I have a mental block for closures, as I've reviewed them dozens of times and momentarily felt like I almost understood them, only to have the understanding slip away again. I guess what I'm wondering is whether there is a way to know, in this video for example before you introduce the asynchronous task in downloadData3, how to decide upon when and how to use closures and completion handlers. In any case, keep up the great work, I really appreciate your effort and attention to detail!
@kavinda_dilshan_paramsoodi
@kavinda_dilshan_paramsoodi 2 жыл бұрын
This is the only video i had watch twice to understand. Thanks nick..... ❤️✌️
@lyndicastrejon4048
@lyndicastrejon4048 Жыл бұрын
Wow, very concise and explained extremely clear
@nolanmorrow6028
@nolanmorrow6028 2 жыл бұрын
Your lessons are excellent!
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thanks Nolan!
@Collins01
@Collins01 2 жыл бұрын
Well explained. ✅
@bruhmoment3731
@bruhmoment3731 2 жыл бұрын
Another very well explained video!
@a4advanture755
@a4advanture755 2 жыл бұрын
super video .. very welll explained
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thank you so much Sikandar!
@MrShumylo
@MrShumylo 2 жыл бұрын
Quite a clear explanation. Thanks a lot!
@pitmanra
@pitmanra 3 жыл бұрын
Well presented, but it still makes my head spin.
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Thanks Pitmanra. Don't stress about this one too much, we're going to be using Combine most of the time anyway! You'll grasp this pretty easily when we start using it in apps :)
@williamwildsmith5162
@williamwildsmith5162 2 жыл бұрын
Had to run through this a few times. Struggle with this - my bad - not bright enough!
@seb2nj457
@seb2nj457 11 ай бұрын
Thanks Nick! this tutorial really do helped me! By the way, I come to curious about a completion handler. As soon as completion handler is called, I understood that the bracket in the upper? function(like getDat function in the video) is called. Than, can I do something AFTER the completion function is completed? Like, writing more code after completionHandler("new data!") block in func downloadData2 Anyway, really easy and good tutorial!
@mig12394
@mig12394 3 жыл бұрын
more and more difficult, but well explained
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
We have to get into the hard stuff sooner or later haha Thanks again for the comment.
@dugrut1325
@dugrut1325 2 жыл бұрын
I’m not sure how many times I watched this video but I think finally I got it. Well I’ll let you know once I start typing code. What I want to do is start a function but as the function is running send out a status @State value to the view in real time. I’m hoping this method of escaping will do that? What do you think?
@ЕнСобЛи
@ЕнСобЛи 2 жыл бұрын
you are the best! Thank you so much
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Thanks for watching!
@abhiireddy6
@abhiireddy6 Жыл бұрын
Crystal clear
@Jeff-zc6rr
@Jeff-zc6rr 6 ай бұрын
But then what is the difference between this and async? It seems there are two options to do things asynchronously.
@SwiftfulThinking
@SwiftfulThinking 6 ай бұрын
Yes, there are 3 main ways actually. Using @escaping closures was the first evolution of Swift, then came Combine, and the newest is async/await. It’s important for iOS devs to know them all. Comparison here: kzbin.info/www/bejne/b5e7emmlaJ6dgrMsi=34gCTbav25aw9gJC
@lowlydeveloper3693
@lowlydeveloper3693 2 күн бұрын
This is a good question! Learning Swift with knowledge of Dart, I am not liking this syntax at all in terms of readability. As Nick is saying here, I understand that devs need to be able to read "old" code when working in teams, but as a solo dev, I definitely prefer to use async/await (just like Dart). So much cleaner, and so much more readable. Thanks for the explanation Nick! 👍
@alextoma402
@alextoma402 Жыл бұрын
I've been trying to understand this for 3 days now
@coffeeCatPeanutDust
@coffeeCatPeanutDust 3 жыл бұрын
Hey Nick. I noticed something that's been reoccurring in a few of your videos and I'm guessing it's just an xcode update, but at 9:41 when you hit enter on the completions, xcode seems to add in parenthesis, whereas in mine, it does not. It doesn't seem to make a difference but still... Are the parenthesis unnecessary?
@m__link6499
@m__link6499 3 жыл бұрын
Hey Nick, in 5:17, why do you write let newData=downloadData() , then text=newData instead of writing directly text=downloadData() 🤔. Thank you
@TheSpiralnotizblock
@TheSpiralnotizblock 2 жыл бұрын
listen on 5:08, he explains why
@lidders
@lidders Жыл бұрын
I've enjoyed your other videos but found this a bit lacking in depth. If the compiler can already tell you need @escaping through the error message why do you need to explicitly state it. Are there cases when you don't need to state it? What is @escaping actually doing?
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
@escaping is telling the compiler that this function we are passing it is going to “escape” the function it’s being called from. In other words, the function passed in can outlive the function it’s called within
@deveshpandey2710
@deveshpandey2710 Жыл бұрын
Can you please share the code,It will be of great help.
@SwiftfulThinking
@SwiftfulThinking Жыл бұрын
github.com/SwiftfulThinking
@dugrut1325
@dugrut1325 2 жыл бұрын
Well my plan did not work. The code worked in that there were no errors but the @StateObject value would not display in the view in real time. I’m at a lost!
@williamwildsmith5162
@williamwildsmith5162 2 жыл бұрын
Not doing it for me, this one! Sorry Nick!
@magedmohmed4403
@magedmohmed4403 Жыл бұрын
Thank you Nick , You are magnificent 🤎
@vazzhh
@vazzhh 7 ай бұрын
ohh. it so complicated 🥲
@SwiftfulThinking
@SwiftfulThinking 7 ай бұрын
You got this 🚀
Codable, Decodable, and Encodable in Swift | Continued Learning #21
35:23
Swiftful Thinking
Рет қаралды 21 М.
How to use weak self in Swift | Continued Learning #18
20:33
Swiftful Thinking
Рет қаралды 18 М.
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 2,4 МЛН
小丑揭穿坏人的阴谋 #小丑 #天使 #shorts
00:35
好人小丑
Рет қаралды 52 МЛН
Human vs Jet Engine
00:19
MrBeast
Рет қаралды 206 МЛН
How to use Dependency Injection in SwiftUI | Advanced Learning #16
35:32
Swiftful Thinking
Рет қаралды 29 М.
Swift Closures Explained
14:23
Sean Allen
Рет қаралды 67 М.
Save and cache images in a SwiftUI app | Continued Learning #27
24:04
Swiftful Thinking
Рет қаралды 13 М.
Download JSON from API in Swift with Combine | Continued Learning #23
34:43
Mo Gawdat on AI: AI's Rapid Evolution
7:21
Mo Gawdat
Рет қаралды 11 М.
How to use Core Data with @FetchRequest in SwiftUI | Continued Learning #14
36:34
How to use VisualEffect ViewModifier SwiftUI | Continued Learning #33
15:01
Swiftful Thinking
Рет қаралды 3,3 М.
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 2,4 МЛН