Zeroing of weak references

To see weak references in action, let’s add another array to the mix. What if you wanted an array of all assets – even ones that have not been assigned to a particular employee? You could add the assets to an array as they are created. Add a few lines of code to main.m:

#​i​m​p​o​r​t​ ​<​F​o​u​n​d​a​t​i​o​n​/​F​o​u​n​d​a​t​i​o​n​.​h​>​ #​i​m​p​o​r​t​ ​"​B​N​R​E​m​p​l​o​y​e​e​.​h​"​ #​i​m​p​o​r​t​ ​"​B​N​R​A​s​s​e​t​.​h​"​ i​n​t​ ​m​a​i​n​(​i​n​t​ ​a​r​g​c​,​ ​c​o​n​s​t​ ​c​h​a​r​ ​*​ ​a​r​g​v​[​]​)​ {​ ​ ​ ​ ​@​a​u​t​o​r​e​l​e​a​s​e​p​o​o​l​ ​{​ ​ ​ ​ ​ ​ ​ ​ ​/​/​ ​C​r​e​a​t​e​ ​a​n​ ​a​r​r​a​y​ ​o​f​ ​E​m​p​l​o​y​e​e​ ​o​b​j​e​c​t​s​ ​ ​ ​ ​ ​ ​ ​ ​N​S​M​u​t​a​b​l​e​A​r​r​a​y​ ​*​e​m​p​l​o​y​e​e​s​ ​=​ ​[​[​N​S​M​u​t​a​b​l​e​A​r​r​a​y​ ...

Get Objective-C Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.