bbcf0c74bb
- 19 Swift source files (~4900 lines) - Complete UI with SwiftUI (MainView, SettingsView, MessageBubble, InputBar) - Inference layer (LlmEngine, Agent, ToolCalling, ConversationContext) - Services (Audio, TTS, WebSearch, ModelDownload, Storage) - Build system: Makefile, Package.swift, Podfile - Documentation: BUILD.md, plan.md, PROJECT_STATUS.md - Ready for Xcode build - just need LiteRT dependency added
5.0 KiB
5.0 KiB
Building Sleepy Agent iOS
Prerequisites
- macOS with Apple Silicon (M1/M2/M3/M4)
- Xcode 15 or later (from App Store)
- iOS 15.0+ device or simulator
- CocoaPods (
sudo gem install cocoapods)
Quick Start
Option 1: Xcode GUI (Easiest)
-
Open the Swift Package in Xcode:
cd sleepy_agent_ios open Package.swift -
Xcode will resolve the package and create a project
-
Add LiteRT dependency:
- File → Add Package Dependencies
- Search for TensorFlow Lite or LiteRT
- Or manually download the framework
-
Configure signing:
- Select the project
- Signing & Capabilities → Team → Select your Apple ID
- Bundle Identifier:
com.sleepy.agent(or your own)
-
Build and run:
- Select target device (your iPhone or a simulator)
- Press Cmd+R
Option 2: CocoaPods + xcodebuild (Command Line)
-
Install CocoaPods dependencies:
cd sleepy_agent_ios pod install -
Open the workspace in Xcode:
open SleepyAgent.xcworkspace -
Or build from command line:
make build # Debug build make archive # Release archive
Option 3: Create Fresh Xcode Project
If the above doesn't work, create a new project:
# Make the script executable
chmod +x create-project.sh
# Run the setup script
./create-project.sh
Then manually copy the Swift files from SleepyAgent/ into your new project.
Creating an .ipa File
For Development/Debugging:
-
Archive the app:
make archive -
Open the archive in Xcode Organizer:
open build/SleepyAgent.xcarchive -
Export as IPA:
- In Organizer, select the archive
- Click "Distribute App"
- Choose "Development"
- Follow prompts to export
For Sideloading (No Developer Account):
Use AltStore or similar tools to install the .ipa without a paid developer account.
For Jailbroken Devices:
# Build and package without signing
make build-release
cd build/Release-iphoneos
mkdir -p Payload/SleepyAgent.app
cp -r SleepyAgent.app/* Payload/SleepyAgent.app/
zip -r SleepyAgent.ipa Payload
Troubleshooting
"No such module 'TensorFlowLite'"
LiteRT-LM needs to be added manually. Options:
- Use CocoaPods: Edit
Podfileand add the correct pod - Use Swift Package Manager: Add TensorFlow Lite as a dependency
- Manual framework: Download from TensorFlow releases
Signing Issues
# Check available signing identities
security find-identity -v -p codesigning
# For development builds, use automatic signing in Xcode
# For distribution, you need a paid Apple Developer account ($99/year)
"Could not find iOS SDK"
# Select Xcode command line tools
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
# Accept license
sudo xcodebuild -license accept
Model Download Issues
The app downloads models from HuggingFace. If downloads fail:
- Manually download from: https://huggingface.co/litert-community
- Place in: Files app → On My iPhone → Sleepy Agent → models/
File Structure
sleepy_agent_ios/
├── SleepyAgent/ # Source code
│ ├── App/ # Entry point
│ ├── Core/ # Models, DI
│ ├── Inference/ # LLM engine
│ ├── Services/ # Audio, network, etc.
│ ├── UI/ # SwiftUI views
│ ├── Info.plist # App config
│ └── SleepyAgent.entitlements # Capabilities
├── Package.swift # Swift Package Manager
├── Podfile # CocoaPods config
├── Makefile # Build automation
└── BUILD.md # This file
Build Commands
# Setup
make setup # Install CocoaPods
make check # Check environment
# Building
make build # Debug build (simulator)
make build-release # Release build (device)
make archive # Create .xcarchive
make ipa # Create .ipa
# Installation
make install # Install to connected device
# Cleanup
make clean # Clean build artifacts
make clean-all # Full clean including Pods
Debugging on Device
- Connect iPhone via USB
- Trust this computer on iPhone
- In Xcode: Window → Devices and Simulators
- Select your device
- Build and run (Cmd+R)
Notes
- LiteRT-LM iOS models: https://huggingface.co/collections/litert-community/ios-models
- Physical device recommended - Simulator can't test audio/camera well
- First launch - Model loading may take 10-30 seconds depending on size
- RAM requirements - E2B needs ~4GB free, E4B needs ~6GB free
Need Help?
Open an issue at: https://github.com/sleepyeldrazi/sleepy-agent/issues