Naming Conventions
Several naming conventions have become widespread within the Objective-C community. To create code that your peers can maintain more easily, try to use the following conventions:
Always capitalize class names.
Begin variable and method names with lowercase letters. If a variable or method name consists of multiple words, capitalize the first letter of the second and any following words. This practice is known as camelcase.
Begin accessor methods that set an instance variable value with the word “set,” and make sure the instance variable name follows in camelcase.
Give accessor methods that return the value of an instance variable the same name as the variable. It is also acceptable—though uncommon—to prefix the variable name with the word “get” and have the instance variable name follow in camelcase.
Do not begin method names that you create with an underscore. By convention, Apple uses underscores to implement system level private functionality.
We’ve implemented these conventions throughout the book.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access