TurboModule Codegen across Android and iOS
Prerequisites: 03-module-interface-map
Code generation paths
Mental model verified
React Native Codegen reads a typed spec from the configured source directory. Android output includes Java/Kotlin-facing abstract APIs and JNI/C++ glue; iOS output includes Objective-C++ and C++ interfaces. The native implementation satisfies those generated contracts.
[S08] [S09]Worked flow synthesis
For readSecureToken(): Promise<string | null>, define nullable result semantics in the spec, run the build/codegen, implement Android Keystore and iOS Keychain behavior, then normalize absent and denied outcomes. This signature is conceptual and not a complete spec.
[S08] [S09]Engineering decision synthesis
Keep specs narrow, avoid passing unbounded collections, and separate platform service logic from generated glue. Regenerate whenever the spec changes and compile both platforms.
[S08] [S09]Failure mode and improvement synthesis
A JS type edit without regenerating and rebuilding native artifacts can leave contract drift. Use build checks on Android and iOS plus device integration tests.
[S08] [S09]Check yourself: What does Codegen provide, and what remains yours?
It creates interfaces and glue; you still implement native behavior, errors, permissions and lifecycle.