Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The interface of a class defines the “public face” of a class—what the class looks like and how it can be interacted with. The interface declaration describes the kind of data the class stores and the various messages you can send it to perform tasks on your behalf. It’s designed to provide enough details for other sections of an application to make use of the class without providing any details on how the class physically achieves its stated capabilities.
The declaration of a new class is signaled by the @interface compiler directive. Everything from this point on, until a matching @end directive, makes up the interface of the class. You may think the use of a directive named @class would make more sense. One way to remember this apparent discrepancy is to realize that your interface must eventually be matched with a suitable implementation, and indeed there is a matching @implementation directive that we cover later in this chapter.