The Main Difference Between Weak and Unowned Is That Weak Is Optional While Unowned Is Non-Optional. by Declaring It Weak You Get to Handle the Case That It Might Be Nil Inside the Closure at Some Point. If You Try to Access an Unowned Variable That Happens to Be Nil, It Will Crash the Whole Program.
When to Use Unowned vs Weak?
•
•
7 min read
★ Key Takeaways
The Main Difference Between Weak and Unowned Is That Weak Is Optional While Unowned Is Non-Optional. by Declaring It Weak You Get to Handle the Case That It Might Be Nil Inside the Closure at Some Point. If You Try to Access an Unowned Variable That Happens to Be Nil, It Will Crash the Whole Program.
Direct Answer • Key Takeaway