Categories
apple ios

What’s the Difference Between Strong and Weak IBOutlets in Swift?

If you’re now not acquainted with ARC (Automatic Reference Counting) in Swift, then you definately must know that once we reference a belongings strongly, it will possibly’t be deallocated till the dad or mum object is destroyed. In circumstances when each gadgets reference in combination strongly, each won’t ever be deallocated, which produces a reminiscence leak. Therefore, we must be very cautious when the usage of robust references.

On the other aspect, if we’ve a vulnerable connection with a belongings, ARC will permit the vulnerable belongings to deallocate when it’s not wanted. A just right instance is the delegation design development, the place we’ve the primary view controller saved as a vulnerable belongings inside of the second one view controller.

Now that you’ve an concept of what robust and vulnerable way, it’s time to come to a decision what garage sort to make use of when operating with @IBOutlets.