Initialize Tauri iOS support with conditional compilation: - Desktop-only features (git CLI, menu, MCP, Claude CLI) gated behind #[cfg(desktop)] - Mobile stubs return graceful errors so frontend degrades smoothly - Vault read/write, AI chat, search, settings work unchanged on both platforms - Xcode project generated, Rust cross-compiles cleanly to aarch64-apple-ios-sim - All 581 Rust tests and 2201 frontend tests still pass Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5.5 KiB
5.5 KiB
iPad Prototype — Tauri v2 iOS Feasibility Report
Date: 2026-03-27 Status: Prototype — Rust cross-compiles to iOS, Xcode project generated, awaiting simulator runtime
Summary
Laputa can be ported to iPad using Tauri v2 iOS (beta) with minimal code changes. The React frontend stays identical. The Rust backend compiles for iOS with conditional compilation to gate desktop-only features (git CLI, menu bar, MCP, Claude CLI). Vault read/write operations work without changes.
What Works
| Feature | Status | Notes |
|---|---|---|
| Rust backend cross-compilation | Compiles cleanly for aarch64-apple-ios-sim |
Zero errors, zero warnings |
| Desktop build (no regressions) | 581 Rust tests pass, 2201 frontend tests pass | Lint and type check clean |
| Tauri iOS project generation | Xcode project generated via tauri ios init |
CocoaPods, xcodegen, libimobiledevice installed |
| Vault file read/write | Expected to work | Pure filesystem operations, no process spawning |
| AI chat (Anthropic API) | Expected to work | Uses reqwest HTTP, no CLI dependency |
| Search | Expected to work | Pure Rust in-memory search |
| Settings persistence | Expected to work | JSON file read/write |
| React UI in WebView | Expected to work | Tauri v2 uses WKWebView on iOS |
What Doesn't Work (Yet)
| Feature | Blocker | Recommended Solution |
|---|---|---|
| Git operations | No git binary on iOS |
Option B (Working Copy) for prototype; Option A (isomorphic-git) for production |
| GitHub clone/push/pull | Depends on git CLI | Same as above |
| Claude CLI streaming | No claude binary on iOS |
Use Anthropic API directly (already available via ai_chat) |
| MCP server / WS bridge | Spawns Node.js child process | Skip for mobile; explore in-process MCP later |
| macOS menu bar | Desktop-only API | Touch-native navigation (already handled by React) |
| Updater plugin | Desktop-only | Use TestFlight for updates |
| File open dialog | Different on iOS | tauri-plugin-dialog supports iOS — needs testing |
Changes Made
src-tauri/src/lib.rs
- Gated
WsBridgeChild,run_startup_tasks,spawn_ws_bridge,log_startup_resultbehind#[cfg(desktop)] - Mobile build skips MCP registration, WS bridge, and vault migrations at startup
- Run event handler gated for desktop (child process cleanup)
src-tauri/src/commands.rs
- Git commands: desktop implementations remain unchanged; mobile stubs return graceful errors or empty results
- GitHub commands: desktop-only; mobile stubs return errors
- Claude CLI commands: desktop-only; mobile stubs return
installed: false - MCP commands: desktop-only; mobile stubs return
NotInstalled - Menu commands: desktop-only; mobile stub is a no-op
- Vault, frontmatter, search, AI chat, settings: unchanged (work on both platforms)
src-tauri/src/lib.rs
pub mod menugated behind#[cfg(desktop)]
src-tauri/capabilities/
default.json: scoped to desktop platforms (linux,macOS,windows)mobile.json: new file with iOS/Android permissions (core, dialog)
src-tauri/gen/apple/
- Full Xcode project generated by
tauri ios init - iPad support: all orientations enabled, arm64 architecture
Architecture: How Mobile Stubs Work
Frontend (React) ──invoke──> Tauri Commands ──> Rust Backend
│
┌──────────┴──────────┐
#[cfg(desktop)] #[cfg(mobile)]
│ │
Real impl Stub (error/empty)
(git CLI, (graceful degradation)
menu, MCP)
The frontend code doesn't change at all. Commands that aren't available on mobile return errors that the UI can handle gracefully (e.g., hiding the git sync panel, disabling commit buttons).
Git Strategy for iPad
Phase 1: Working Copy (Recommended for prototype)
- User manages vault with Working Copy (git client for iPad)
- Laputa opens the vault via iOS Files API / FileProvider
- Zero git code needed in Laputa — Working Copy handles sync
- Pro: Works immediately, robust git implementation
- Con: Requires separate app, split UX for sync
Phase 2: isomorphic-git (Production)
- Pure JS git implementation running in the WebView
- Replace
invoke("git_commit")etc. with JS-side git operations - Pro: Integrated UX, no external dependency
- Con: Slower on large vaults (~9200 files), limited advanced git features
Phase 3: git2-rs / gitoxide (Future)
- Pure Rust git library compiled into the Tauri binary
- Best performance, no JS bridge overhead
- Con: Larger binary size, more integration work
Next Steps
- Install iOS simulator runtime —
xcodebuild -downloadPlatform iOS(downloading ~7GB) - Full Xcode build —
npx tauri ios build --target aarch64-sim - Launch on iPad simulator —
npx tauri ios dev - Test vault read/write — open a vault, read/edit a note
- Test AI chat — verify Anthropic API calls work from iOS WebView
- Evaluate touch UX — identify layout issues on iPad screen size
- File Provider integration — test opening vaults from Working Copy via iOS Files
Prerequisites Installed
- Rust iOS targets:
aarch64-apple-ios,aarch64-apple-ios-sim,x86_64-apple-ios - Xcode 16.2 with iOS 18.3.1 simulator runtime (downloading)
- CocoaPods 1.16.2, xcodegen 2.45.3, libimobiledevice 1.4.0
- Tauri CLI 2.10.0 with iOS support