Including resources

Native code sometimes requires additional resources, such as layout or image files. These work in slightly different ways on Android and iOS but can be easily included in modules for both.


To include resources they must be placed in the inspector/an-inspector/ForgeModule/res folder.

For more information about what kind of resources can be added to your module and how they can be used with the Android SDK, see the official Android docs concerning App Resources.


On iOS, any resources included in your module must be part of a bundle.

3rd party bundles can be included by placing the bundles in module/ios/bundles. An inspector project update will then be required to include them in the inspector for development

If you have resources such as images that you want to include in your module, you must create your own bundle. The inspector project includes a ForgeModuleResources target which can be used to help with this:

  • All bundles must have a unique name - you can name your bundle by setting the Product Name for the ForgeModuleResources target.

module set bundle name

  • Add the required resources to the ForgeModule project and include them in the ForgeModuleResources target.

  • Use the named bundle to reference these resources from your native code, with code like this:

     NSString * bundlePath = [[NSBundle mainBundle] pathForResource:@"my_bundle_name" ofType:@"bundle"];
     NSBundle * myBundle = [NSBundle bundleWithPath:bundlePath];

For more information, see Accessing a Bundle's Contents.

  • When building UniversalForgeModule your bundle will be output in the build folder: make sure to include this in ios/bundles/ in your module folder.

In Summary:

  1. Run UniversalForgeModule to produce build folders.

  2. Copy inspector/ios-inspector/build/<bundle_name>.bundle to module/ios/bundles/<bundle_name>.bundle

  3. Quit Xcode.

  4. Update iOS inspector.

  5. Reopen Xcode. Note that <bundle_name>.bundle is listed under ForgeInspector's frameworks.

  6. Any new or changed resources will require you to start again at step 1.