Daily iOS
Memory and ARC

weak vs strong

Can you explain the difference between weak and strong?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

strong adds 1 to the reference count and owns the target's lifetime; weak doesn't raise the count and doesn't own it. Since the target can go away first, a weak reference always has to be an optional var.

Share a question