Reputation:
I opened an XCode project produced as a tutorial by Apple ("Auto Layout Cookbook"), when I found two files with a strange naming:
Both contain an extension called Recipe. I was not able to find any docs about this kind of naming.
Is there any reason why they named the files this way?
Upvotes: 7
Views: 3547
Reputation: 130172
The naming comes from Objective-C where every extension for a class needed a name. For example, a class Recipe
could have extension:
@interface Recipe (Loading)
@end
which contained methods related to "Loading".
Such extensions were commonly put into files named Recipe+Loading.h
(that is, class Recipe
extended with Loading
methods).
In Swift extensions don't have a name but old habits die hard. They used the same naming for files.
Upvotes: 10
Reputation: 41246
This is a common naming convention from Objective-C. As you surmised it basically contains extensions to Recipe
that pertain to loading and storyboards respectively. It's primarily a way to break up large source files or label extensions to system classes (String, Array, etc.)
Upvotes: 0