#58: Using [weak self] in Swift Closures
When an escaping closure is stored by an object that also gets captured by the closure, you can easily create a retain cycle.
loader.onFinish = { [weak self] image in
self?.imageView.image = image
}
Capturing self weakly breaks that cycle because the closure no longer owns the object.
Use this when the closure should stop doing work if the owner disappears. If the object must stay alive while the closure runs, a strong capture may still be the right choice.