- Clear step-by-step guide for building in Xcode GUI - Command-line alternative provided - Troubleshooting tips for common issues - Architecture overview included
99 lines
2.6 KiB
Markdown
99 lines
2.6 KiB
Markdown
# Building Bagsy on iOS
|
|
|
|
## Current Status ✅
|
|
|
|
- ✅ All dependencies installed via CocoaPods
|
|
- ✅ Xcode workspace ready (`Bagsy.xcworkspace`)
|
|
- ✅ iPhone 16 detected and connected
|
|
- ✅ Compatibility patches applied (Expo 54 + React Native 0.75)
|
|
- ✅ ~5GB free disk space available
|
|
|
|
## Building in Xcode (GUI) - **RECOMMENDED**
|
|
|
|
This is the most reliable way to build and debug:
|
|
|
|
1. **Open the workspace:**
|
|
|
|
```bash
|
|
open /Users/barnabasbodily/shop/apps/mobile/ios/Bagsy.xcworkspace
|
|
```
|
|
|
|
2. **In Xcode:**
|
|
- Select **Bagsy** scheme (top menu)
|
|
- Select **JDB iphone16** device (top menu, next to scheme)
|
|
- Click **Play** button (or `Cmd+R`)
|
|
|
|
3. **First build will take 5-10 minutes** (codegen runs automatically)
|
|
- Watch the build log for progress
|
|
- React Native codegen compiles natively
|
|
- Hermes JavaScript engine builds
|
|
|
|
4. **Subsequent builds are much faster** (1-2 minutes)
|
|
|
|
## Building via Command Line
|
|
|
|
If you prefer CLI:
|
|
|
|
```bash
|
|
cd /Users/barnabasbodily/shop/apps/mobile/ios
|
|
|
|
# For physical device (recommended)
|
|
xcodebuild -workspace Bagsy.xcworkspace \
|
|
-scheme Bagsy \
|
|
-configuration Debug \
|
|
-destination 'id=00008140-000E71921EE3801C' \
|
|
build
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Build still fails with codegen errors
|
|
|
|
- Try: `Cmd+Shift+K` in Xcode to clean build folder
|
|
- Then: `Cmd+B` to rebuild
|
|
- Codegen should regenerate automatically
|
|
|
|
### Disk space errors
|
|
|
|
We already cleared ~2GB of caches. If you get low disk warnings:
|
|
|
|
```bash
|
|
# Remove old Xcode archives
|
|
rm -rf ~/Library/Developer/Xcode/Archives/*
|
|
|
|
# Remove old DerivedData
|
|
rm -rf ~/Library/Developer/Xcode/DerivedData/*
|
|
```
|
|
|
|
### Slow builds
|
|
|
|
- First build: Normal (compiles all native code)
|
|
- Enable ccache for faster rebuilds: `USE_CCACHE=1 xcodebuild ...`
|
|
- Or in Xcode settings: Enable "Use Clang module caches"
|
|
|
|
## After Build
|
|
|
|
Once the app builds successfully:
|
|
|
|
1. It will automatically run on your iPhone 16
|
|
2. Look for "Bagsy" app on home screen
|
|
3. App opens to a blank "Home" screen (default template)
|
|
4. No backend connectivity yet (API not fully implemented)
|
|
|
|
## Next Steps
|
|
|
|
1. **Implement backend API** - See `apps/api/` for Next.js API routes
|
|
2. **Connect to backend** - Update `EXPO_PUBLIC_API_URL` in `.env`
|
|
3. **Implement UI screens** - See `apps/mobile/app/` for routing
|
|
|
|
## Architecture Notes
|
|
|
|
- **Framework:** React Native (Expo) + Hermes engine
|
|
- **Bundler:** Metro
|
|
- **Native:** Swift/Objective-C via CocoaPods
|
|
- **Code generation:** React Native Codegen (auto-runs during build)
|
|
|
|
---
|
|
|
|
**Current device:** iPhone 16 (connected as `JDB iphone16`)
|
|
**Workspace:** `/Users/barnabasbodily/shop/apps/mobile/ios/Bagsy.xcworkspace`
|