Guide to Reference

ARC is a compile time feature that is Apple’s version of automated memory management. It stands for Automatic Reference Counting. This means that it only frees up memory for objects when there are zero strong references/ to them.

A guide to reference: when to use Strong reference, Weak reference, Unowned reference, ImplicitlyUnwrappedOptional property

 

Optional

non-Optional

Optional

strong reference &

weak reference 

 strong reference & 

unowned reference

non-Optional

strong reference &

unowned reference 

 unowned reference & 

implicitly unwrapped optional property

Leave a Reply

Your email address will not be published. Required fields are marked *