r/SwiftUI • • 3h ago

I built an open-source native macOS proxy manager with SwiftUI + AppKit (Swift 6, NavigationSplitView, bridged NSTableView, native cascading NSMenu)

1 Upvotes

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!


r/SwiftUI • • 8h ago

What is the hardest part of SwiftUI that still trips you up?

5 Upvotes

I have been building with SwiftUI for a while now, and navigation and state still catch me out sometimes. What is the part of SwiftUI that still trips you up, even after using it for a while?


r/SwiftUI • • 8h ago

I built an open-source Apple Photos-style image viewer for SwiftUI

Post image
9 Upvotes

Hey everyone! 👋

I wanted to share an open-source SwiftUI library I've been working on called SwiftUIPhotoViewer.

The idea was to create a native-feeling photo viewer inspired by Apple Photos, while keeping it easy to integrate and fully customizable.

Features:

  • Smooth thumbnail-to-fullscreen hero transitions
  • Pinch-to-zoom and pan gestures
  • Interactive drag-to-dismiss animations
  • Customizable captions, titles and loading indicators
  • Animated GIF support
  • Zero external dependencies
  • Swift Package Manager support
  • iOS 17+

It's built using SwiftUI and UIKit, and is available under the MIT license.

GitHub: https://github.com/wnifirami/SwiftUIPhotoViewer

I'd love to hear your feedback, especially on the animations, API design, and any features you think are missing.


r/SwiftUI • • 18h ago

Promotion (must include link to source code) A couple of weeks ago I shared my SwiftUI real-time stem separation app here. It now has a click track, transpose and a speed control (open source)

21 Upvotes

Hi all! A couple of weeks ago I posted Stelix here. It's a menu bar app that splits whatever your Mac is playing into vocals, drums, bass and other while it plays, with a slider for each one. I've shipped two updates since then, so here's what changed.

You can now transpose Live and Studio up or down by up to 12 semitones, and the drums aren't shifted with the rest. There's a click on the beats of the song, in both modes, where you pick the meter, the accent and the sound, or load a sound of your own. In Studio you can play the stems anywhere from 20% to 200% speed without changing the pitch, and save them at that speed. The BPM and the key of the song are shown above the controls and change when the song does.

The click, BPM and key come from Apple's on-device Music Understanding framework, so they need macOS 27. Transpose and speed work from macOS 15.

On the SwiftUI side I redesigned the panel. Transpose, speed and the click settings now sit in one "Controls" box under the stem sliders, with the BPM and key in its header. It uses Liquid Glass on macOS 26 and later, and the older look before that.

Source (GPL-3.0): https://github.com/stelix-app/stelix

Website and download: https://getstelix.com

If you already have it, it will offer the update by itself. I've only been able to test on macOS 27, so if you're on 15 or 26 I'd like to know whether it works for you, thanks!


r/SwiftUI • • 21h ago

Question How to recreate the native draggable tab bar indicator without the background?

3 Upvotes

Hey everyone,
I’m currently developing a Swift app and want to recreate the native iOS tab bar interaction, but with just the text labels and the draggable selection pill, without the surrounding tab bar background.
The ChatGPT iOS app implemented pretty much exactly what I’m looking for in a recent update.
I’ve already tried a bunch of different approaches:

  • Modifying existing tab bar recreations on GitHub to remove the background
  • Looking for standalone implementations of the draggable selection pill
  • Exploring projects that use undocumented APIs

Unfortunately, most of these approaches are either too limited or don’t quite capture the native look and feel, especially when it comes to animations and dragging behavior.
Does anyone have an idea how to achieve this? Ideally using public APIs, but I’d also be interested in understanding how ChatGPT implements it.
I’ve attached a screen recording showing exactly what I’m trying to achieve.
Any help would be greatly appreciated!


r/SwiftUI • • 21h ago

Scaffolding 4.0 - full Stinsen usage parity

Thumbnail
github.com
3 Upvotes

Hey!

Just released Scaffolding 4.0. It's a SwiftUI coordinator pattern navigation library for iOS 18+ that's made as a Stinsen spiritual successor, for iOS 18 and above.

As this is a major update, many things have changed and are well documented in docs https://dotaeva.github.io/scaffolding/documentation/scaffolding/migratingto4.

Most notable change, which brings Stinsen's type safety to the table is move to typed routes. Routes are no longer automatically handled by Macro, but need to be annotated as `@Route`. This mitigates the need for user to specify expected typed when deeplinking. Usage becomes easier while avoiding Stinsen's keypaths, thus allowing autocomplete and compiler to help fully.

Apart from this, async has been preferred for a few patches, but now it's the only to use for specific scenarios where they are used. Closure syntax has now been removed. API's have been cleaned as well as code under the hood.

// 3.x
func settings() -> any Coordinatable { SettingsCoordinator() }


route(to: .settings, expecting: SettingsCoordinator.self)?
    .route(to: .account)


// 4.0
@Route func settings() -> SettingsCoordinator { .init() }


route(to: .settings)?
    .route(to: .account)

r/SwiftUI • • 22h ago

Tutorial How do people create Muscle Maps in Swift?

Post image
1 Upvotes

r/SwiftUI • • 23h ago

Drop Banner - A fluid in-app banners for SwiftUI

31 Upvotes

DropBanner, a banner that slides down from the top of the screen in a smooth, fluid way, Inspired by @jumeh work on X

It slides down smoothly and either pushes your screen down or floats over it as a card. Put any SwiftUI view inside.

iOS 17+, MIT

source: https://repgem.com/drop-banner-ios

Would love your feedback!


r/SwiftUI • • 23h ago

Promotion (must include link to source code) Open-sourced BentoKit (MIT): Offscreen SwiftUI .glassEffect(.regular) Metal renderer + Apple 20x12 Bento & carousel toolkit

Thumbnail
gallery
19 Upvotes

We have been building, using, and refining this internally for our Mac app Droppy for months, and just open-sourced the full codebase under the MIT license.

A big part of making Apple WWDC-style release Bentos look right is getting genuine macOS Liquid Glass refraction on hero typography, SF Symbol strips, and shortcut keycaps without opening any app window or faking it with CSS blur. Here is how the SwiftUI rendering pipeline works under apple-bento/src/:

1. Offscreen SwiftUI .glassEffect into Metal (glassword.swift, glyph.swift, keycaps.swift)
- glassword.swift turns a string into exact vector outlines using CoreText (CTLineCreateWithAttributedString + CTFontCreatePathForGlyph) inside a custom SwiftUI Shape (GlyphShape), optionally rounding corners via path stroking/union and supporting per-glyph or GlassEffectContainer composition.
- It renders Color.clear.glassEffect(.regular, in: shape) (or .clear with tint/stack options) over a backdrop image inside an NSHostingView hosted in a custom OffscreenWindow subclass (NSWindow overriding isKeyWindow, isMainWindow, _hasActiveAppearance, and no-op orderFront so nothing ever appears on screen).
- The layer tree is rasterized headless via Core Animation CARenderer directly into an offscreen MTLTexture at @3x, and we also emit a pixel-registered --noglass baseline so glass_proof.py can generate a 400% rim refraction diff proof.
- glyph.swift does the same for native SF Symbols: it parses the symbol's vector PDF drawing commands with CGPDFScanner to reconstruct clean CGPath outlines, then applies .glassEffect with left-to-right color stops across a symbol row.

2. Icon Composer ictool + calibrated bezels + 20x12 CoreGraphics composer
- make_icon.py builds multi-layer vector SVG .icon bundles and invokes Xcode's ictool --platform macOS --design-generation 27 for Default, Dark, ClearLight, and ClearDark renditions.
- compose.swift and tilt3d.swift handle the 20x12 Apple recap templates, 4-panel flowing social carousels (4800 x 1500 into four 1200 x 1500 panels), Core Animation 3D tilted UI stages, and procedural dithered tile backgrounds.
- bezel.py ships 9 calibrated Apple hardware bezels (MacBook Pro ProLED, MacBook Pro Notch, MacBook Air, MacBook Neo, Studio Display XDR, iMac, iPhone Pro) with display-cutout validation.

The attached renders were all produced straight from the CLI (meta Reddit Bento, X Bento, flowing 4-panel Facebook carousel, and the BentoKit overview). Requires macOS 26+ and Xcode 26+.

Full source (MIT): https://gitlab.com/droppyformac1/bentokit


r/SwiftUI • • 1d ago

News The iOS Weekly Brief: Issue #89

Thumbnail
iosweeklybrief.com
1 Upvotes

Siri AI limits, App Store Awards, new iOS beta, clean projects for AI agents, if and switch as expressions, safe area, SwiftUI sheets, SceneStorage, SwiftUI co-creators Q&A, a Git client for worktrees


r/SwiftUI • • 2d ago

Menu bar app on macOS: LSUIElement hides the Dock icon, but Settings opened behind everything

6 Upvotes

I built a menu bar only app with SwiftUI MenuBarExtra, and I wanted no Dock icon.

Apple's docs say to set LSUIElement to true in the Info plist for that. That part is fine. The app starts as an accessory, no Dock icon, no Cmd-Tab.

The part that surprised me was Settings. I opened it from the menu bar extra, and the window appeared behind the app I was already using. Clicks went through to Safari, and I couldn't type in my own window until I found it in Mission Control.

That happens because clicking a status item does not activate your app. makeKeyAndOrderFront only makes the window key once the app is active, so the window is ordered front in your app, but the other app stays in front on screen.

What worked for me is to activate, then bring the window forward:

func show(_ window: NSWindow) {
    NSApp.activate()
    window.makeKeyAndOrderFront(nil)
}

On macOS 14 and later, activate(ignoringOtherApps:) is deprecated, and activate() is only a request. Sometimes the system just doesn't give you focus. If the window still opens behind, a fallback I have seen is to switch to .regular while Settings is open, then go back to .accessory when the last window closes. Don't call setActivationPolicy in App.init(), NSApp is not ready there.

func showSettings() {
    NSApp.setActivationPolicy(.regular)
    NSApp.activate()
    settingsWindow.makeKeyAndOrderFront(nil)
}

func windowWillClose(_ notification: Notification) {
    let stillOpen = NSApp.windows.contains { $0.isVisible && $0.styleMask.contains(.titled) }
    if !stillOpen {
        NSApp.setActivationPolicy(.accessory)
    }
}

One more thing on macOS 26 and later: System Settings > Control Center can hide a menu bar extra. If MenuBarExtra is your only visible scene and the app is accessory, the process can just quit when the extra is hidden, with no useful crash log. I would either keep a fallback Dock icon, or use a normal NSStatusItem so the process can stay alive and show the Dock icon instead.

Happy to hear if someone has a pure SwiftUI way to bring Settings in front without the policy switch.


r/SwiftUI • • 2d ago

GitHub - poise52/USBview-HS: Native USB inspector for macOS(Swift, haskell). Explore the USB device tree, inspect descriptors, and reconnect devices or hubs from the menu bar.

Thumbnail
github.com
2 Upvotes

Hey everyone,

I’ve been working on USBview HS, an open-source (MIT) native USB inspector for macOS (15+, Apple Silicon).

If you've ever needed to see what’s actually going on behind a tangle of USB-C docks and nested hubs—or wanted to software-reset a misbehaving USB device without crawling under your desk to unplug it—that’s what this tool is built for.

What it does

  • Full USB Topology Tree: Inspect controllers, nested hubs, and even empty ports. It automatically groups the USB 2 and USB 3 sides of the same physical connector when the macOS I/O Registry links them.
  • Software Reconnect (Reset): Reset a USB device or hub directly from the app or the menu bar via IOUSBHostDevice.reset(), and verify whether it reappears on the same port.
  • Deep Inspection:

    • Ports: Awake/sleep current limits, per-link error counters, and USB-C transport info.
    • Devices: VID:PID, serial numbers, negotiated speeds, drivers, interfaces, and on-demand Configuration Descriptors (alternate settings & endpoints).
    • Adapters & Drives: BSD interface names, MAC, MTU, and link state for USB Ethernet adapters; media/partition info and write capability for drives.
  • Menu Bar & Mini Window: Quick access to connected devices right from the menu bar, plus an optional always-on-top floating mini window.
  • Search & Event Log: Filter by name, manufacturer, or VID:PID, with configurable auto-refresh and a log tracking the last 200 attach/detach events.
  • Headless CLI Mode: Query the exact same USB topology from the terminal—dump the tree, export to JSON, watch live attach/detach events, or filter by --network, --storage, and --details.

Under the hood

Architecturally, it’s a bit of an unusual mix: a Haskell backend engine (engine/) reads directly from the macOS I/O Registry via IOKit and constructs the USB topology, while a Swift 6 / SwiftUI frontend (app/) handles the native UI, reads configuration descriptors through IOUSBLib, and triggers device resets.

Installation & Quick Notes

  • Pre-built Apple Silicon .zip binaries are available on GitHub Releases (built via GitHub Actions), or you can build from source with make run.
  • Gatekeeper note: Releases are ad-hoc signed and not notarized by Apple, so if macOS blocks the first launch, you can clear the quarantine flag with xattr -dr com.apple.quarantine "/Applications/USBviewHS.app".
  • Language note: The UI currently defaults to Russian on first launch—you can switch to English right away via Настройки (Settings) → Язык интерфейса (the choice persists across launches)

r/SwiftUI • • 2d ago

Promotion (must include link to source code) Yet another Lightweight player - InnerPlayer

Post image
0 Upvotes

Apple Music / iTunes was always complicated for me. Wanted something simple, to sort music, play music from folder, make playlists. So AI came and although I am not Swift programmer, now I am 🤔

It has simple DJ support, can read rekordbox library and you can quickly test tracks in simple DJ setup. Planning to add some more features.

It is open source and free.

GitHub https://github.com/ktwist/InnerPlayer

Page: https://ktwist.github.io/InnerPlayer/

InnerPlayer isn't notarised by Apple yet, so macOS blocks the first launch (“Apple could not verify…”).

Feedback Wellcome


r/SwiftUI • • 3d ago

Blink v1.2 — Free open-source Mac app that keeps your screen awake only while you're looking at it (+ Keep Awake mode & seamless notch buddies)

Thumbnail gallery
6 Upvotes

r/SwiftUI • • 3d ago

Tutorial iOS 27.1: DeviceHinge

Thumbnail
antongubarenko.substack.com
1 Upvotes

r/SwiftUI • • 3d ago

I built Hedwig – A native macOS app to manage API keys and development secrets

Thumbnail reddit.com
1 Upvotes

r/SwiftUI • • 3d ago

Promotion (must include link to source code) I open-sourced two SwiftUI iOS apps: a Linux server monitor and an SSH client

2 Upvotes

I released the source for two SwiftUI apps I built for iPhone and iPad.

Nodex's app entry is a SwiftUI App. It's an agentless Linux server monitor over SSH, and it shows host health, services, logs, and Docker or Podman containers.

Termex's app entry is also a SwiftUI App, with SwiftUI screens for servers, keys, known hosts, settings, and onboarding. It's an SSH client with tmux session continuity and native SFTP. Some supporting views also use UIKit.

Both are MIT.

Nodex: https://github.com/magrathean-uk/Nodex Termex: https://github.com/magrathean-uk/Termex


r/SwiftUI • • 3d ago

Solved I rebuilt a Linux desktop's bar panels in SwiftUI, matching the original's design pixel for pixel

Post image
3 Upvotes

For my project omarchy-macos (Omarchy's Linux desktop look, on macOS), I rebuilt Omarchy's QML bar panels as a SwiftUI menu-bar app: Wi-Fi, audio, Bluetooth, power, display, calendar and weather.

Some things that were interesting to solve:

- Porting QML layouts to SwiftUI with the same metrics and font scale

- Following the theme live: every panel re-renders from a palette file when you switch themes

- Talking to CoreAudio, CoreWLAN, IOBluetooth and DisplayServices directly

- A ~30 KB C client so clicks on the bar open panels instantly (launching the Swift binary added visible lag)

It's built with swiftc and a shell script, no Xcode project. Source (MIT):

https://github.com/prashantkoirala465/omarchy-macos/tree/main/src/barpanel

Feedback on the code is welcome.


r/SwiftUI • • 3d ago

A native SwiftUI iPad/iOS/MacOS client app for a local LLM

0 Upvotes

I built a native SwiftUI iPad/iOS/MacOS client app (not a chromium or browser control hosted like most of the people do) for a local LLM served by any OpenAI-compatible server over the LAN. It’s a chat harness with streaming, conversation history, tool calling, and settings. Partially as a learning exercise in building a harness and partially as a way to access my LLM when I am away from my computer. Here’s the repo: https://github.com/alexyak/Sparkle

Planning to add more features like skills, agents… etc.. There’s an option to use a local on-device Apple model as well.

Disclaimer: I have a decades-long experience in software and application development, including iOS development, but I have been gladly accepting the help from Claude Coding agents 😉. 


r/SwiftUI • • 4d ago

Solved GitHub - SRAYANSH-GUPTA/Blackburn---Ios-Dev-on-linux

Post image
1 Upvotes

r/SwiftUI • • 4d ago

Open-sourced Snagless: SwiftUI @Environment crashes caught at build time, using SwiftSyntax

0 Upvotes

Our codebase has hundreds of `@Environment` call sites. Any one of them can crash in production with "No Observable object of type X found" if a view gets shown without the value injected somewhere above it, and the compiler can't see it. Every fix I found started with "first, change all your call sites."

So I built Snagless, a SwiftPM/Xcode build plugin. It reads your SwiftUI source with SwiftSyntax, works out which view shows which across modules, and fails the build when a view can appear without a value it needs. Zero code changes, about 90 ms on a 431-file app.

Built with Claude Code, and the write-up is upfront about every time the AI was wrong and what caught it.

Write-up: https://tarek-builds.dev/p/swiftui-environment-crashes-compile-just-fine-so-i-made-them-fail-the-build/
Repo: https://github.com/tareksabry1337/snagless

Happy to answer questions.


r/SwiftUI • • 4d ago

Tutorial My Swift layout: one Xcode project, no workspace, one local package for every platform

Thumbnail
aleahim.com
0 Upvotes

I build for SwiftUI, AppKit and UIKit on Mac, iPhone and iPad, and my layout used to start with a workspace. A project template can create and open a project, but it can't leave you in an open workspace.


r/SwiftUI • • 4d ago

onDisappear alternative? Trying to detect when a tab is not active in a child view.

3 Upvotes

TabView(selection: $selection) > Tab > FeedView

Trying to implement a TikTok style feed and I want the FeedView to know when another tab has been opened so I can stop the music/video from playing. I tried onDisappear on the FeedView but it lags behind for a few moments. Should I pass the value of the currently selected tag to the feed view or is there a better way to do this?


r/SwiftUI • • 4d ago

Question Would you use a lightweight menu bar app that brings iPhone’s "Attention Aware" display feature to MacBooks?

Thumbnail reddit.com
0 Upvotes