Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You can use a similar strategy to provide a hidden setter (for internal use) for properties that are publicly declared as readonly. You do this by redeclaring the readonly property in an extension in the class’s .m file (see Chapter 11, “Categories, Extensions, and Security”). To make employeeNumber in the Employee class from Listing 12.7 and 12.8 writable internally, you can modify Listing 12.8 to look like this:
#import "Employee.h" @interface Employee () @property (nonatomic, readwrite) int employeeNumber; @end @implementation Employee @synthesize employeeNumber; @synthesize name; @synthesize supervisor; @synthesize salary; ... @end