Information Technology Reference
In-Depth Information
Naming new files
Xcode doesn't enforce a naming convention for new files, so it's up to you to name files using a scheme that
works for you. By default, the class files are named
class.m
and
class.h
, which is unhelpful, especially if
you use more than one class.
It's good practice to include both the project and functional class name in every new class; for example, a new
view controller for the flip view in an iOS project might be called
FlipsideViewController
. Terse and
obscure names such as
AClass
or
MyClass
will confuse you later and are best avoided.
Adding a new class
When you add a new Objective-C class, Xcode automatically adds a header file to the project. Where needed, it
also adds a matching implementation file to the project. There are five templates for iOS classes and four tem-
plates for OS X classes, with significant overlap, as shown in Table 5.1.