Great! The explanation is so clear and easy to understand. But it seems that the audio volume is a quite low. Keep up the good work!
@iOSAcademy4 жыл бұрын
Thank you!
@hykim51374 жыл бұрын
Awesome! I was really looking forward to a video on this topic from you. Thank you for making it.
@iOSAcademy4 жыл бұрын
Youre welcome!
@dalton48424 жыл бұрын
Clearest explanation out there for this :)
@iOSAcademy4 жыл бұрын
Thanks! Did you like my balloon example hahaha
@Денис-ж3ф5р3 жыл бұрын
Not even a month ago, did I think the topic is incredibly hard to understand. It's a piece of cake now.
@iOSAcademy3 жыл бұрын
Glad to hear it
@wannabemusician55194 жыл бұрын
omg Thank you so much for explaining this out.! i love ur content btw. :)
@iOSAcademy4 жыл бұрын
Youre welcome!
@chatsnoirblamo4 жыл бұрын
Thank you because I learned Java in Eclipse and it was obvious we were pretending memory didn’t exist. That’s fine for python scripts but I want to move into real apps!
@iOSAcademy4 жыл бұрын
Youre welcome! Glad i could help
@rahuljamba58462 жыл бұрын
Very unique way to define weak and strong also handle memory leakage.
@hustlas4ever4 жыл бұрын
wow! was reading about this the other day and can't really understand. lol. Thank you for this.
@iOSAcademy4 жыл бұрын
Ha ha you’re welcome, glad I could help. Don’t forget to subscribe!
@ievgenievgen36512 жыл бұрын
You give wrong examples about reference cycles. In all your examples, you use a local reference type variable of functions. Such variables do not hold by class it is in the function scope. If you move your alert var in class scope, then you will get ref cycle. You can easily check that by using the deinit in your class for checking did you viewcontroller call it or not.
@afaaqahmedsaqi3 жыл бұрын
It was awesome, best explanation ever scene on this topic!
@iOSAcademy3 жыл бұрын
Thanks!
@hasanbasriozturk15503 жыл бұрын
Still the best
@iOSAcademy3 жыл бұрын
Thanks!
@kuldeep49543 жыл бұрын
Please do a follow up video
@iOSAcademy3 жыл бұрын
Coming soon
@faastfood4 жыл бұрын
I tried AlertConroller example and checked in instruments but didn't get leaks indicator. Can you please tell me why is it happening?
@puneetmahali16474 жыл бұрын
Yes, I have also some confusion, as video tutorial states that the code doesn’t give any error but if give weak self then it will not leak the memory. Then how do we know when n where memory will leak?
@choonshon51654 жыл бұрын
Tell me if I’m wrong.. but I think it’s because the AlertController is not owned by the “ViewController”. Once dismissed, the AlertController has no reference pointing it and it is released.
@ningzedai90523 жыл бұрын
The answer is simple, what this youtuber said is not correct about the alert controller. The alert controller is not owned by "self", so there is no retain cycle. He is misleading others.
@alamgirkhan0012 жыл бұрын
Great explanation! Make a video on Local DB in IOS App with SQLite.
@iOSAcademy Жыл бұрын
Will do soon
@jiayi41544 жыл бұрын
Thank you very much for the content! Can you do one for core data and saving and retrieving in an ios file system?
@iOSAcademy4 жыл бұрын
Youre welcome & sure! Added to my list
@amielterence3 жыл бұрын
Thanks bro, really helped a lot👌🏽
@iOSAcademy2 жыл бұрын
Glad it helped
@rudolphhock11553 жыл бұрын
It doesn't seem that iOS is going to pick up on memory leaks. I haven't delved into this subject much more than this video, but surely Swift should have built in tools to help pinpoint memory leaks ?
@araapoyan28143 жыл бұрын
You are the best
@iOSAcademy3 жыл бұрын
haha thanks!
@RahulGupta-wp6bk3 жыл бұрын
Very Helpful video...Thanks Bro.. :)
@iOSAcademy3 жыл бұрын
Your welcomd! Dont forget to subscribe and like
@dev_jeongdaeri4 жыл бұрын
Super awesome!
@iOSAcademy4 жыл бұрын
Thanks
@boxinggio4 жыл бұрын
In SomeDelegate example you wrote weak var delegate : SomeDelegate? is weak necessary? I think making it optional is already weak right?
@iOSAcademy4 жыл бұрын
Weak is needed to avoid retain cycle.
@boxinggio4 жыл бұрын
iOS Academy but optional doesn't already have weak reference?
@dodilodi12783 жыл бұрын
12:00 It would be the same even if func getData() wasnt private?
@vuralcelik80604 жыл бұрын
Great explanation !
@iOSAcademy4 жыл бұрын
Thanks!
@radiagulzan4 жыл бұрын
thank you !
@iOSAcademy4 жыл бұрын
Youre welcome
@TephrosXI2 жыл бұрын
What if the "self" in a closure was of Struct type; Is it still possible to have a retain cycle?
@neslzkusfep Жыл бұрын
Hi westo127! My response may not be the most precise or accurate as I am also still learning, but this is my understanding of iOS memory management. To address your question, the object's data type (i.e. Struct) isn't the concern. A retain cycle occurs when two separate objects are strongly pointing to (referencing) each other; if one of the objects is deallocated (removed) from memory while another object is still strongly referencing it, the object that is referencing the deallocated object will still exist in memory somewhere, pointing to (or otherwise linked to) some object that no longer exists in memory - taking up space while serving no purpose. The goal of proper memory management is to ensure that objects that are added to memory are deallocated if they are no longer being used. In the example provided, there are two objects: ViewController and Alert. The parent ViewController object is strongly pointing to a child Alert object because the Alert object is defined within the ViewController object; this Alert object is a separate object from the ViewController object though it is defined in the ViewController class. If memory is properly managed, the Alert object should be deallocated from memory if the ViewController gets deallocated from memory. Before the edit was made to the Alert object's handler, the Alert object was strongly referencing the parent ViewController class by calling the parent ViewController's method 'doSomething()'. Since the ViewController object strongly references the Alert object and the Alert object is strongly referencing the ViewController by calling the ViewControllers doSomething() method, this causes a retain cycle. To prevent a retain cycle, you want the child Alert object to weakly reference the ViewController's doSomething method; that way when the user dismisses the Alert object from the View - an action that should deallocate the Alert object from memory - the strong reference to the ViewController won't prevent that from happening. Hope this was helpful and not just a reiteration of what was previously discussed in the video. :)
@RatherBeCancelledThanHandled3 жыл бұрын
Thanks for sharing but it seems to me like there is no point in using a strong reverence . Why wouldn’t we use a weak reference ?
@TheBooban3 жыл бұрын
Strong is default because you don’t want your object to just disappear when you need it, do you? So figure out how you want to handle it, and then use weak.
@pratikgajbhiye53544 жыл бұрын
One small question, when to use self and when not?
@iOSAcademy4 жыл бұрын
Swlf is needed in closures
@aviadsabag81934 жыл бұрын
When you want to ref to your current variable inside VC, for example in init u can assign what u get as a param into your local variable. for exmaple - self.count = count(the param that u get from the user). btw there's self in every programming langue :)
@intros18542 жыл бұрын
I feel pretty embarrassed 🤭. I made whole project with memory leaks 😂. Thanks, I'm gonna fix it right now
@iOSAcademy2 жыл бұрын
We’ve all been there!
@sharbel96243 жыл бұрын
For some reason I'm having a hard time replicating this on swiftUI rather than UIKit. Any chance anyone can help me out here?
@jason184014 жыл бұрын
So should use [weak self] in all closures?
@iOSAcademy4 жыл бұрын
Yes, almost 99 percent of time
@Chromasophy2 жыл бұрын
self? as an optional makes sense ~
@iOSAcademy2 жыл бұрын
Agreed
@龘䨺齉纞靐鼱麤鸞驫3 жыл бұрын
weak selfムズすぎる😭
@iOSAcademy3 жыл бұрын
Yep haha
@Shermyyy4 жыл бұрын
#suddenlyitalian completino hahaha but great video! very informative!!
@AkimboFennec2 жыл бұрын
Not a good explanation. Did not understand it at all.
@iOSAcademy2 жыл бұрын
Thanks for the feedback
@vikramt872 жыл бұрын
very very complex.. please dont upload this kind of videos create more confusion