Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Nimbus Namespacing

jverkoey edited this page · 2 revisions

If you plan to use Nimbus in a static library that you will distribute to third party developers then you should consider using Nimbus' namespace facilities. Namespacing will avoid duplicate symbol errors when the third party developer decides to add Nimbus to their application.

Using the namespace facility is easy. First, define a preprocessor macro named __NIMBUS_NAMESPACE_PREFIX_ in your library target's settings and assign it some name.

For example, if you want all Nimbus classes, externs, and functions to be prefixed by FooBar, you would add __NIMBUS_NAMESPACE_PREFIX_=FooBar to your preprocessor macros.

Second, import the +Namespace header before each feature's corresponding header.

For example, if you use core and models, your precompiled header would look like:

#import "NimbusCore+Namespace.h"
#import "NimbusCore.h"
#import "NimbusModels+Namespace.h"
#import "NimbusModels.h"

You're done. Rebuild your library and all of the Nimbus features will now be prefixed with the prefix you specified. This will avoid any duplicate symbol errors when someone decides to use Nimbus in their own application. This solution has the significant benefit of being completely transparent to the developer.

Something went wrong with that request. Please try again.