Memory management is one of the most important topics that every developer should be aware of when making their app very responsive and efficient. Swift uses Automatic Reference Counting (ARC) to manage memory. In ARC, freeing up memory and managing it is done automatically when instances are no longer needed. Although ARC does most of the work in memory management, you have to care about the relations between classes to avoid memory leaks.
In memory, each object has a reference counting, and when it reaches zero, this object will be deallocated from the memory. In Swift, we have two types of references:
strong references retain the object and increment its reference counting by 1; the
weak references don't ...