December 2015
Intermediate to advanced
400 pages
13h 3m
English
Unfortunately, Swift does not give you access to the actual reference count of any instances.
Even if you could ask an instance what its reference count is, the answer you get might not be what you expect. Throughout this chapter, we said things like, “At this point, the reference count is 2.” That was a white lie.
Conceptually, it is perfectly reasonable for you to think of reference counts the way we described. Under the hood, the compiler is free to insert additional calls to retain (increment the reference count) and release (decrement the reference count). As long as it does its job correctly, there is no harm to your program. If you could ask what the actual ...
Read now
Unlock full access