Two Languages in One

Objective-C was designed as a strict superset of C, which means that any C program is also a valid Objective-C program. The Objective-C designers decided to keep the C language intact and add special syntax for object-oriented features to make it easy to distinguish between the two. Also retained from C is division of the code for each class into two files: a header file with a .h extension that defines publicly available interface of methods and properties for the class and a method file with a .m extension that defines the implementation of the methods. If you have read any of the iOS chapters, you have already seen these files in your project.

The following is a brief overview of some of the coding constructs that the ...

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android 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.