Hi, good video, what do you think of the use of "unowned", in the 3rd example it can be relevant sometimes to use it, it avoids an unnecessary guard let when you know that if the closure is called self still exists
Oh!! It's really useful! I am a student studying iOS in South Korea. So I wanted to translate it to Korean and post it on my blog to make more people see it (I am not using it to make any profit! & I'll put a link to the original video in my post.) is it OK?
Very informative video vincent, so with closure at line 27 there would not be a memory leak is it correct? There is no reference to the closure, and so, there is no retain to self. But diving a bit deeper: 1)There would be a kind of retain to self anyway, as that closure executes after 2 seconds, even if the ViewModel gets deallocated. Correct? 2) The ViewModel can't get deallocated, until the DispatchQueue.after is executed. Correct?
For second example I am trying to crash app without weak self by poping back view controller or making reference nil but its always capturing self and not crashing is it because apple created it ? for our clousres we need to add [weak self ] which escapes ?
thank you for your clip, I've learned something new today, it's helpful, much appreciated, and also I want to ask a simple question: do we need to use [weak self] in case of present AlertController or any animation (any code to use in animation: { } ) ?
Great topic! Another good topic would be when to use unowned. For example in your 3rd example I think unowned would be perfect because when self is deinited handler will also be removed.
Did you find this explanation useful? Do you think of a situation that doesn't fit in my three examples? Let me know in the comments 🚀
Hi, good video, what do you think of the use of "unowned", in the 3rd example it can be relevant sometimes to use it, it avoids an unnecessary guard let when you know that if the closure is called self still exists
@@jeremymagnier good question! There’ll actually be a video on this exact topic later this month 🤫
@@v_pradeilles I activate the bell so haha
Good example. It will be good if we can have part 2 representing the retain cycle in memory graph
Oh!! It's really useful! I am a student studying iOS in South Korea.
So I wanted to translate it to Korean and post it on my blog to make more people see it
(I am not using it to make any profit! & I'll put a link to the original video in my post.) is it OK?
really useful content. your videos have been extremely useful for my iOS interview questions thx!
Could you also consider an example with multiple nested closures and explain where we need to specify weak self to avoid retain cycles.
Great question! I've actually already covered this topic in a separate video: ua-cam.com/video/2Ot86h_Xu1M/v-deo.html
good example, thank you for sharing
This still makes my head hurt :). I wish the compiler could just figure it out for all cases and create a warning/error.
Thanks for the explanation. It's very useful.
Very informative video vincent, so with closure at line 27 there would not be a memory leak is it correct? There is no reference to the closure, and so, there is no retain to self.
But diving a bit deeper:
1)There would be a kind of retain to self anyway, as that closure executes after 2 seconds, even if the ViewModel gets deallocated. Correct?
2) The ViewModel can't get deallocated, until the DispatchQueue.after is executed. Correct?
For second example I am trying to crash app without weak self by poping back view controller or making reference nil but its always capturing self and not crashing is it because apple created it ? for our clousres we need to add [weak self ] which escapes ?
thank you for your clip, I've learned something new today, it's helpful, much appreciated, and also I want to ask a simple question:
do we need to use [weak self] in case of present AlertController or any animation (any code to use in animation: { } ) ?
I’d say it’s only required in the 3rd example
Great topic! Another good topic would be when to use unowned. For example in your 3rd example I think unowned would be perfect because when self is deinited handler will also be removed.
The video on that exact topic is coming later this month 😉
AÏE LIKE YOURE FRENCH ACCENTE. GOUD VIDEO ALRIGHT