Difference between weak and unowned in Swift

Difference between weak and unowned in Swift

17.346 Lượt nghe
Difference between weak and unowned in Swift
In this tutorial we will explore the difference between weak and unowned keyword in swift. Most of the time we use weak to avoid strong reference cycle and help automatic reference counting ARC to manage memory better. Unlike weak we also have a unowned keyword which does the same. But the question is when to use weak and unowned and what's the difference between the two? In this tutorial we will explore the difference between weak and unowned keyword in details. Given below are the chapters for today's video 0:00 introduction 1:38 revision of strong reference cycles 6:39 why we need weak and unowned keyword 7:30 weak keyword 8:25 unowned keyword 9:00 when to use weak and unowned keyword 9:13 example of when to use weak keyword 9:42 rules to use weak 10:26 example of when to use unowned keyword 11:56 second example of unowned 13:09 updating demo code 13:52 unowned arc documentation 16:00 conclusion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Given are the links mentioned in today's video iOS Cafe discord server invitation link: https://discord.gg/gB3mhP8DNq Automatic reference counting video link: https://youtu.be/XAlXnApplk0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ✅ Subscribe to the channel and stay ahead of everyone by following the right way for writing clean code in swift. 🔥🔥🔥🔥🔥 🔗Click on the link to subscribe: https://www.youtube.com/c/codecat?sub_confirmation=1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ############################################ Connect with me on social media Instagram: codecat15 📧: [email protected] 🐦: https://twitter.com/codecat15 Facebook: https://www.facebook.com/code.cat.792 Github: https://github.com/codecat15 ########################################### #weakvsunowned #arcInSwift #swiftHindiTutorial