I'm a little confused regarding the description given for the conflict between the variable titled favorites
in the header file and the favorites
property defined in the same:
"Note that we're declaring a property named favorites, of type NSMutableArray. In our header file, we just declared a method called favorites that returns an NSArray. Since declaring a property also typically declares the existence of a getter and a setter, won't this lead to a conflict?
The description for the potential conflict seems to indicate that the definition of favorites in the interface section will clash with the methods generated by the property statement for favorites in the class extension of the implementation file. However as I understand it, defining a property using the property key word will generate methods with the names getFavorties and setFavorites, along with an instance variable named _favorites. Thus I'm not really clear on where this potential clash would occur as noted, but there must be something I'm missing else the explanation in the book wouldn't have been provided.
Another question i have is: if it is the mutability of the array that we are concerned with here, could we not have used the copy keyword in our property definition for the favorites array and accomplished the same goal?
Thanks in advance for your assistance.
Here is the text from the book:
(strong, nonatomic) NSMutableArray *favorites;