Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
remember back in the mists at the dawn of time when we wrote accessor methods for our instance variables? We wrote a lot of boilerplate code, creating both a -setBlah method to set the object's blah attribute (obviously) and a -blah method to retrieve it. If the attribute is an object, we needed to retain the new one and release the old one. There are utilities out there that will turn your class definition into method declarations and definitions that you can paste into your files. But still, writing accessor methods is a lot of mindnumbing work that can better be applied to doing the cool stuff that's unique to your program.
In Objective-C 2.0, Apple introduced properties, a combination of new compiler directives and a new attribute accessor syntax. The new properties feature greatly reduces the amount of mindless code you have to write. Throughout this chapter, we'll be modifying 10.01 CarParts-Init to use properties. The final code for this chapter can be found in the 11.01 CarProperties project.