Dot Syntax
We should mention an alternative syntax for sending accessor messages to an object called dot syntax:
// Following two lines are exactly equivalent int value = [item valueInDollars]; int value = item.valueInDollars; // Following two lines are exactly equivalent [item setValueInDollars:5]; item.valueInDollars = 5;
We have reservations about Objective-C newcomers using dot syntax. We think it hides the fact that you are actually sending a message and can be confusing. Once you are comfortable with Objective-C, it is totally okay ...
Get iOS 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.