Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
A cycle occurs when objects keep each other alive through strong references, including closure captures. A weak capture can break the cycle when the captured object may disappear first.
For example, an owner stores a callback and that callback strongly captures the owner. ARC cannot release this cycle automatically. A weak capture does not keep the object alive and becomes nil after deallocation, so the callback must handle its absence. An unowned reference requires a valid lifetime guarantee; accessing it after deallocation can trap. Choose captures from ownership and lifetime requirements, rather than adding weak everywhere.