iOS setup
Configure the threaded runtime in your iOS app delegate, install pods, and prewarm runtimes from Swift.
Install pods
After installing the npm packages, run pod install:
cd ios
bundle exec pod installIf pod install fails with a Nitro-related error, ensure
react-native-nitro-modules is in your dependencies and that you ran
npm install first.
Configure the runtime from the app delegate
Configure threading before any secondary runtime is created — typically the very first call in your delegate setup:
import NativeComposeThreadedRuntime
@main
class AppDelegate: RCTAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
) -> Bool {
ThreadedRuntime.configure(
withReactNativeDelegate: self,
launchOptions: launchOptions
)
// ... your existing setup
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}Order matters
If you call prewarmRuntime before configure, the runtime cannot find the
React Native delegate and the prewarm will fail silently.
Prewarm runtimes at launch
For any runtime the user is likely to see in the first navigation, start it during app launch so the first surface mounts with zero delay:
ThreadedRuntime.prewarmRuntime("conversation-inbox-runtime")
ThreadedRuntime.prewarmRuntime("messages-runtime")For an app-lifetime background runtime that shares native modules with the
main runtime, use prewarmBusinessRuntime:
ThreadedRuntime.prewarmBusinessRuntime("background")See Background thread architecture for the full pattern.
C++ prewarm
If you need to prewarm from C++ (for example, from a Nitro module's constructor), use the dispatcher header:
#include <nativecompose/threadedruntime/ThreadedRuntimeDispatcher.h>
nativecompose::threadedruntime::prewarmRuntime(
"conversation-release-room-runtime"
);Common issues
`Undefined symbol: _NativeComposeThreadedRuntime`
Re-run pod install and clean the build folder
(xcodebuild clean or Product → Clean Build Folder in Xcode).
Threaded surfaces show up blank
Confirm that your index.js loads .threaded-runtime/entry when
global.__THREADED_RUNTIME_ENV__ is set — without it, the secondary runtime
has no components registered.