51 lines
1.5 KiB
Markdown
51 lines
1.5 KiB
Markdown
# CxWebAppMac
|
|
|
|
Native macOS SwiftUI shell that wraps the CxWebApp C++/Crow backend in a
|
|
`WKWebView` with proper window chrome, menu commands, health monitoring, and
|
|
configurable backend URL.
|
|
|
|
## Build & run
|
|
|
|
```sh
|
|
cd swift-app
|
|
make build # swift build -c release
|
|
make run # launches a SwiftUI window
|
|
make test # runs AppSettingsTests
|
|
make app # produces build/CxWebAppMac.app
|
|
```
|
|
|
|
Override the backend at launch:
|
|
|
|
```sh
|
|
CXWEBAPP_URL=https://cxwebapp.76-13-126-127.nip.io swift run -c release CxWebAppMac
|
|
```
|
|
|
|
## Layout
|
|
|
|
```
|
|
swift-app/
|
|
├── Package.swift
|
|
├── Makefile
|
|
├── README.md
|
|
├── scripts/
|
|
│ └── build-app.sh # SPM bin → .app bundle
|
|
├── Sources/CxWebAppMac/
|
|
│ ├── CxWebAppMacApp.swift # @main, WindowGroup + Settings scene
|
|
│ ├── ContentView.swift # toolbar + WebView + status bar
|
|
│ ├── WebView.swift # WKWebView NSViewRepresentable
|
|
│ ├── SettingsView.swift # backend URL, presets, devtools toggle
|
|
│ ├── AppSettings.swift # persisted preferences
|
|
│ └── HealthMonitor.swift # polls /api/health
|
|
└── Tests/CxWebAppMacTests/
|
|
└── AppSettingsTests.swift
|
|
```
|
|
|
|
## Commands (⌘ shortcuts)
|
|
|
|
- ⌘R — reload
|
|
- ⌘[ / ⌘] — back / forward
|
|
- ⇧⌘H — home
|
|
- ⇧⌘C — copy URL
|
|
- ⇧⌘O — open in default browser
|
|
- ⌘, — Settings (backend URL, presets, developer extras)
|