Nice reading. You read about things you think you know, and yet there is always something you didn't know. :)
One thing I would like to know after reading this post is the explanation why when you use unowned reference it sometimes crashes and that It's because the other difference between weak and unowned:
weak will not retain the reference counter of the object and the variable will be set to nil when the last strong reference to the object was removed.
unowned will also not retain reference counter of the object, but variable will still hold reference to an object even if it does not exist anymore, and if you do not set it to nil explicitly (like in old times of Manual Memory Management in Objective-C) it will cause crash if you try to use it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice reading. You read about things you think you know, and yet there is always something you didn't know. :)
One thing I would like to know after reading this post is the explanation why when you use
unowned
reference it sometimes crashes and that It's because the other difference betweenweak
andunowned
:weak
will not retain the reference counter of the object and the variable will be set tonil
when the last strong reference to the object was removed.unowned
will also not retain reference counter of the object, but variable will still hold reference to an object even if it does not exist anymore, and if you do not set it tonil
explicitly (like in old times of Manual Memory Management in Objective-C) it will cause crash if you try to use it.