Projects
Now that we have a pretty good understanding of Objective-C, let's discuss what Objective-C code looks like in a project. Unlike the Swift code, Objective-C is written in two different types of files. One of the types is called a header file and it ends in the extension h
. The other type is called an implementation file and ends in the extension m
.
Before we really discuss what the difference between the two is, we first have to discuss code exposure. In Swift, all the code that you write is accessible to all other code in your project. This is not true with Objective-C. In Objective-C, you must explicitly indicate that you want to have access to the code in another file.
Header files
Header files are the types of files that can be included by other files. This means that header files should only contain the interfaces of types. In fact, this is why the separation exists between class interfaces and implementations. Any file can import a header file, and this essentially inserts all...