XCFramework Packaging
When using @callstack/brownie in a brownfield app, the brownfield CLI automatically detects Brownie and builds its XCFramework alongside your React Native module.
Build Output
Running npx brownfield package:ios produces the following XCFrameworks in ios/.brownfield/package/:
<scheme name>.xcframework- Your React Native moduleBrownie.xcframework- Brownie shared state libraryhermesvm.xcframework(orhermes.xcframeworkfor RN < 0.82.0)ReactBrownfield.xcframework
The consumer app needs to embed all 4 frameworks when using Brownie.
Note: This command also takes care of running brownfield codegen for you.
Integration Options
Drag and Drop
-
Build the XCFrameworks:
-
Open your native Xcode project
-
Drag all XCFrameworks from
ios/.brownfield/package/into your project:BrownfieldLib.xcframeworkBrownie.xcframeworkhermesvm.xcframeworkReactBrownfield.xcframework
-
In target settings → General → Frameworks, Libraries, and Embedded Content, ensure all frameworks are set to Embed & Sign
Swift Package Manager
You can also distribute the XCFrameworks via SPM by creating a binary target package. See XCFramework Packaging for details.
Importing Brownie
After embedding the framework, import it in your Swift code:
Then use the generated store types:
