Episode 1
What Is Automatic Reference Counting (ARC)
Before we can discuss Automatic Reference Counting, ARC for short, you need to understand the difference between value types and reference types.
Before we can discuss Automatic Reference Counting, ARC for short, you need to understand the difference between value types and reference types.
In the previous installment of this series, you learned about Automatic Reference Counting and how it helps keep memory management in check. Remember that a class instance is deallocated if no properties, constants, or variables hold a strong reference to the class instance. I didn't explain what a strong reference is, though.
Automatic Reference Counting, or ARC for short, was introduced in Objective-C several years ago. It greatly simplifies memory management in Swift and Objective-C. Automatic Reference Counting usually works without you having to do anything. But there are scenarios in which ARC needs a little bit of help.
If you've been paying attention, then you may have noticed that we haven't resolved the strong reference cycle of the Device class. Remember from earlier in this series, this is what the Device class looks like.