Skip to content

Commit e0661eb

Browse files
committed
feat: docs
1 parent 8d570b0 commit e0661eb

4 files changed

Lines changed: 59 additions & 0 deletions

File tree

apps/RNApp/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"eslint": "^8.19.0",
4444
"jest": "^30.2.0",
4545
"prettier": "3.7.4",
46+
"react-native-monorepo-config": "^0.3.2",
4647
"react-test-renderer": "19.1.1",
4748
"typescript": "^5.9.3"
4849
},

docs/docs/brownie/_meta.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,10 @@
2323
"type": "file",
2424
"name": "swift-usage",
2525
"label": "Swift Usage"
26+
},
27+
{
28+
"type": "file",
29+
"name": "xcframework-packaging",
30+
"label": "XCFramework Packaging"
2631
}
2732
]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# XCFramework Packaging
2+
3+
When using `@callstack/brownie` in a brownfield app, the `brownfield` CLI automatically detects Brownie and builds its XCFramework alongside your React Native module.
4+
5+
## Build Output
6+
7+
Running `npx brownfield package:ios` produces the following XCFrameworks in `ios/.brownfield/package/`:
8+
9+
- `<scheme name>.xcframework` - Your React Native module
10+
- `Brownie.xcframework` - Brownie shared state library
11+
- `hermesvm.xcframework` (or `hermes.xcframework` for RN < 0.82.0)
12+
- `ReactBrownfield.xcframework`
13+
14+
The consumer app needs to embed all 4 frameworks when using Brownie.
15+
16+
## Integration Options
17+
18+
### Drag and Drop
19+
20+
1. Build the XCFrameworks:
21+
22+
```bash
23+
npx brownfield package:ios --scheme BrownfieldLib --configuration Release
24+
```
25+
26+
2. Open your native Xcode project
27+
28+
3. Drag all XCFrameworks from `ios/.brownfield/package/` into your project:
29+
- `BrownfieldLib.xcframework`
30+
- `Brownie.xcframework`
31+
- `hermesvm.xcframework`
32+
- `ReactBrownfield.xcframework`
33+
34+
4. In target settings → **General****Frameworks, Libraries, and Embedded Content**, ensure all frameworks are set to **Embed & Sign**
35+
36+
### Swift Package Manager
37+
38+
You can also distribute the XCFrameworks via SPM by creating a binary target package. See [XCFramework Packaging](/docs/cli/brownfield) for details.
39+
40+
## Importing Brownie
41+
42+
After embedding the framework, import it in your Swift code:
43+
44+
```swift
45+
import Brownie
46+
```
47+
48+
Then use the generated store types:
49+
50+
```swift
51+
@UseStore(\AppStore.counter) var counter
52+
```

yarn.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,7 @@ __metadata:
22192219
prettier: "npm:3.7.4"
22202220
react: "npm:19.1.1"
22212221
react-native: "npm:0.82.1"
2222+
react-native-monorepo-config: "npm:^0.3.2"
22222223
react-native-safe-area-context: "npm:^5.6.2"
22232224
react-native-screens: "npm:^4.19.0"
22242225
react-test-renderer: "npm:19.1.1"

0 commit comments

Comments
 (0)