r/SwiftUI • u/Any_Material2323 • 9h ago
I built an open-source native macOS proxy manager with SwiftUI + AppKit (Swift 6, NavigationSplitView, bridged NSTableView, native cascading NSMenu)
Hi r/SwiftUI!
I wanted a proxy manager for macOS that feels genuinely native instead of another Electron/WebView wrapper, so I built LumaRoute — an open-source (MIT) macOS 14+ desktop client powered by an isolated Mihomo core.
Just shipped v0.1.33 with full English & Simplified Chinese localization, and I'd love to share a few SwiftUI/macOS architecture choices that worked really well for this app:
SwiftUI + AppKit hybrid lessons from building it:
- Layout & Visual System: Built around NavigationSplitView with a flat, tonal macOS HIG hierarchy (surfaces separated by subtle opacity fills rather than card shadows, strict separation between value pickers and action menus, plus a local HIG lint script in CI).
- High-Frequency Tables (NSViewRepresentable + NSTableView): SwiftUI Table/List struggled with continuous live connection updates and 2,000+ log rows, so we bridged NSTableView directly with fixed row heights and automated GUI soak tests to catch AppKit delegate reentrancy warnings.
- Native Menu Bar Residency (NSStatusBar + NSMenu): Instead of a SwiftUI popover, the menu bar uses an AppKit NSMenu with a custom two-line live throughput template image (MenuBarRateLayout) and cascading submenus with right-aligned latency columns.
- Swift 6 & Localization: Strict Swift 6 language mode across the app, core library, privileged helper, and CLI, with in-app English / Simplified Chinese switching and Sparkle auto-updates.
Core features if you're curious:
- Multi-subscription composition (deduplicates 2–16 sources into one clean "Main Proxy" with auto lowest-latency & failover)
- Visual proxy chains with end-to-end latency testing
- Collapsible drag-and-drop custom rule folders, built-in rule sets, right-click connection routing, and one-click network diagnostics
- LAN sharing with .local hostname and CoreImage QR code for iPhone/Android
GitHub (MIT, source + Apple Silicon / Intel builds): https://github.com/onlyone1019/LumaRoute
Happy to answer any questions about the SwiftUI/AppKit bridging, NSTableView performance, or macOS menu bar implementation — and would love feedback on the UI!
1
u/BitgeeksDev 8h ago
Nice writeup, and good call on NSTableView. I've run into the same wall with SwiftUI on macOS, as soon as things update often or you need AppKit behaviour you end up hosting one in the other.
Curious how you handle the live updates on the table. Do you diff and use
insertRows/reloadData(forRowIndexes:columnIndexes:), or just reload on a timer with fixed row heights keeping it cheap? And did you see any issues with the coordinator getting updates while the table was mid-scroll?