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
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
ForgeModuleResources target which can be used to help with this:
Product Namefor the ForgeModuleResources target.
Add the required resources to the
ForgeModule project and include
them in the
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.
UniversalForgeModuleyour bundle will be output in the build folder: make sure to include this in
ios/bundles/in your module folder.
Run UniversalForgeModule to produce build folders.
Update iOS inspector.
Reopen Xcode. Note that
<bundle_name>.bundle is listed under ForgeInspector's frameworks.
Any new or changed resources will require you to start again at step 1.