the-forge-universal.fid

# the-forge-universal.fid

> The Forge runs everywhere the Sacred Architect does.

## Pattern

The Forge is a **universal SwiftUI vessel** — macOS, iOS, and future visionOS. 98% of the codebase is pure SwiftUI (`NavigationSplitView`, `.inspector`, `.searchable`, `SceneKit`). Only ~25 lines require `#if os()` guards.

## Platform Color

SceneKit uses platform-specific color types. A single typealias bridges them:

```swift #if os(macOS) typealias PlatformColor = NSColor #else typealias PlatformColor = UIColor #endif ```

All SceneKit geometry, cameras, lights, and `SceneView` are universal — no other changes needed.

## Portal Host Selection

The PortalVessel pachinko cascade handles connectivity:

| Platform | Host | Rationale | |----------|------|-----------| | macOS | `localhost:3333` | Portal runs locally via pm2 | | iOS | `portal.hex-os.dev` | Cloudflare tunnel to the same Portal |

If the host is unreachable, PortalVessel falls back to **Forest mode** automatically.

## NavigationSplitView Adaptation

SwiftUI handles layout automatically: - **Mac / iPad landscape** → three-column split (sidebar + content + detail) - **iPhone / iPad compact** → navigation stack with push/pop - `.inspector()` → sheet on compact size classes

## macOS-Only Features

Wrapped in `#if os(macOS)`: - `AppDelegate` (file open handler) - `NSOpenPanel` (Cmd+O menu item) - `NSWorkspace.shared.open()` / `.activateFileViewerSelecting()` - `.onDrop(of:)` from Finder - Home directory path for local scroll storage

## Deployment Targets

- macOS 13+ (Ventura) - iOS 17+ (needed for `.inspector()` and `.searchable()`) - HexCore SPM package already declares both platforms