Memory and ARC
Swift counts references to class instances. Use weak or unowned to avoid retain cycles.
Example
class Node {
weak var next: Node?
deinit { print("freed") }
}
var a: Node? = Node()
a = nilExercise
Avoid cycles.
var next: Node?Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.