let x = User()?
y = x
z = y
y = nil
z
User
Reference count for "x" should be 2, is that right?
Yes, you are passing around references, and you did that twice.
Does
z
become nil, or does it continue to beUser
?
No, z
does not become nil, since z
holds a reference to the User
. When y
is set to nil, the reference count drops to 1, so it stays alive.