Having worked w/ languages that utilized namespaces for the past 10 years I am trying to figure out the best approach to project structure and class开发者_JAVA技巧 names in objective-c (iOS4+). Should you simply give all your classes, view controllers, etc. unique names? It seems archaic there is not a way to encapsulate groups of functionality with something like namespaces, especially if you build libraries and have a large development team.
Is there functionality equivalent to namespaces that I am missing? If not, what is a good approach to this problem?
Thanks
Should you simply give all your classes, view controllers, etc. unique names?
Yes.
The standard approach is to prefix class names with a short code. For instance, traditional Cocoa uses NS
(from NextStep), while Cocoa Touch uses UI
(for user interface, I guess).
精彩评论