How does one use namespaces in iOS objective-c code

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I m writing an iOS app, "Best Korea". My organization name is "Srsly.co". I m going to write re-usable "News" libraries that I ll use across my apps.

Each iOS app will have its own app-wide constants in a .h file, and the library code will have its constants as well in header files. I ll also have tests for each of these projects.

Is this the standard way of doing things?

In Ruby, Python, Java, etc., I d set up namespaces along these lines:

co.srsly.bestkorea
co.srsly.bestkorea.test
co.srsly.newslib
co.srsly.newslib.test

As far as I can see, the Objective-C pattern is for each developer to choose two or three upper-case letters and prefix every class name with them.

So in my case, I m thinking I d choose BK as the app s classname prefix and NL for the news lib code? Am I thinking about this the right way?

http://stackoverflow.com/questions/1021035/are-namespace-collisions-really-an-issue-in-objective-c?rq=1 http://stackoverflow.com/questions/1021035/are-namespace-collisions-really-an-issue-in-objective-c?rq=1

Answers

http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/ProgrammingWithObjectiveC/Conventions/Conventions.html http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/ProgrammingWithObjectiveC/Conventions/Conventions.html

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/15539041/how-does-one-use-namespaces-in-ios-objective-c-code

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils