iOS Installation
This guide will help you set up your development environment for building iOS applications with Cuppa.
Prerequisites
Before you begin, ensure you have the following installed:
- macOS 12.0 (Monterey) or later
- Xcode 15.0 or later
- Xcode Command Line Tools
- Node.js 20.0.0 or higher
- pnpm 9.0.0 or higher (recommended) or npm/yarn
- CocoaPods 1.12.0 or higher
Installing Xcode
Download Xcode from the Mac App Store or Apple Developer website:
# Install Xcode Command Line Tools
xcode-select --install
# Verify installation
xcode-select -p
Installing CocoaPods
CocoaPods is required for managing iOS dependencies:
# Install CocoaPods
sudo gem install cocoapods
# Verify installation
pod --version
Creating a New iOS Project
Option 1: Using Cuppa CLI (Recommended)
# Create a new Cuppa project with iOS support
pnpm create @mycuppa/app my-app --platforms ios
cd my-app
Option 2: Adding iOS to Existing Project
If you already have a Cuppa project:
# Navigate to your project
cd my-cuppa-app
# Add iOS platform
pnpm cuppa add-platform ios
Project Structure
After installation, your project will have this structure:
my-app/
├── ios/ # iOS native code
│ ├── App/
│ │ ├── ContentView.swift
│ │ └── AppDelegate.swift
│ ├── Podfile
│ └── App.xcodeproj
├── src/ # Shared TypeScript code
│ ├── components/
│ ├── hooks/
│ └── services/
└── package.json
Installing iOS Dependencies
Install the required Cuppa packages for iOS:
# Install Cuppa iOS packages
pnpm add @mycuppa/ios @mycuppa/core @mycuppa/ui
# Install iOS native dependencies
cd ios
pod install
cd ..
Running Your iOS App
Using Xcode
- Open
ios/App.xcworkspacein Xcode - Select a simulator or connected device
- Press
Cmd+Rto build and run
Using CLI
# Run on iOS simulator
pnpm ios
# Run on specific simulator
pnpm ios --simulator="iPhone 15 Pro"
# Run on physical device
pnpm ios --device
Troubleshooting
Pod Install Fails
If pod install fails, try:
cd ios
pod repo update
pod install --repo-update
Build Errors
Clear derived data and rebuild:
# Clean build
rm -rf ios/build
rm -rf ~/Library/Developer/Xcode/DerivedData
# Rebuild
pnpm ios
Simulator Not Found
List available simulators:
xcrun simctl list devices
Next Steps
Now that you have Cuppa installed for iOS, continue to the Quick Start guide to build your first iOS app.