When should I use a prefix on Objective C classes?
According to Apple, two to three letter prefixes should be used
when naming classes, protocols, functions, constan开发者_运维技巧ts, and typedef structures.
Does this include classes which are not intended to be part of a framework, simply used internally in an application? I realize this is relying on other developers that develop frameworks you might be using to use prefixes, but that seems acceptable. What about Core Data entities? If I generate classes from them, shouldn't they be prefixed as well?
To be safe, use a prefix for all classes in your application. All classes are loaded into a single flat namespace in Objective-C and the prefix prevents collisions both now and in the future.
This also includes CoreData entities; they should also use the same prefix as the rest of your application's classes.
Also note that you may decide some of this code could be used elsewhere, so using prefixes now will safeguard you from potential collisions in the future.
精彩评论