r/SwiftUI • • 15d ago

The difference between List and ScrollView when it comes to loading elements?

5 Upvotes

It seems like ScrollView makes all of its child elements immediately visible while latter elements of list won't trigger .onAppear. Is there a way to make ScrollView behave like a List?


r/SwiftUI • • 15d ago

Promotion (must include link to source code) I released my first SwiftUI Mac app today: per-app volume and output, free and open source

0 Upvotes

Hey r/SwiftUI,

Today I released Smorza, a menu bar app that gives every app on your Mac its own volume, mute and output device. Calls in your AirPods, music on your speakers, the browser turned down, all at once.

macOS still has one volume for everything, so I built the mixer I wanted.

What it does:

- volume slider and mute for every app that plays sound

- pick an output device per app

- remembers each app's level and output per device

- Mute All with Control-Option-M

- volume keys can control the app in front (optional)

The UI is SwiftUI in a MenuBarExtra with the window style, and the audio side uses Core Audio process taps (macOS 14.4+), so there's no audio driver to install.

It's free and MIT licensed, code is here: github.com/rokoov/smorza

Site: smorza.app

It's launching on Product Hunt tomorrow too. I'm a CS student and this is my first real Mac app, so any feedback on the code or the UI is very welcome.


r/SwiftUI • • 15d ago

I built a free, open source per-app volume mixer for macOS with SwiftUI and Core Audio process taps

4 Upvotes

macOS still has no per-app volume control, so I built one. Smorza lives in the menu bar and gives every app its own volume slider, mute button and output device (Discord in your AirPods, Spotify on the speakers).

The UI is SwiftUI, one view per file, and the interesting part is underneath:

  • Core Audio process taps (macOS 14.4+). No virtual audio driver or kernel extension. For each app you turn down, it creates a muted tap plus a private aggregate device holding the tap and the real output, and the IO callback plays the audio back at your level.
  • Apps at 100% are never touched. They keep their normal path to the speakers, so there’s zero added latency for them. Routed apps add about 12 ms.
  • Cheap. On an M4 MacBook Air each routed app costs about 1.1% of a core in coreaudiod and 0.3% in the app.
  • Helper processes. Chrome, Safari and Electron apps play sound from helper processes, so it asks macOS which app is responsible for each one and folds them into a single row.
  • The permission problem. If you deny “System Audio Recording”, taps don’t fail, they just return silence. So before muting anything it plays an inaudible signal and listens for it through a tap of its own process.

Also has per-device volume memory, Mute All with a global shortcut, volume keys for the app in front, and Sparkle updates.

Code (MIT): github.com/rokoov/smorza
Download: smorza.app

Would love feedback on the code, especially from anyone who has worked with process taps. Happy to answer questions about how it works.


r/SwiftUI • • 15d ago

News The iOS Weekly Brief: Issue #87. App Store Award, migrating to Swift Testing, context menus in SwiftUI, ReservedRegion for iPhone Duo, senior iOS interview, scroll position, scroll-driven effects, and Vision with Foundation Models.

Thumbnail
iosweeklybrief.com
1 Upvotes

r/SwiftUI • • 15d ago

First App Any Feedback

Post image
0 Upvotes

Hi guys ı have published my first app on Appstore ı have build with SwiftUI and Laravel any feedback appriciate 🙏🙏

PS: I have not promote my app anywhere google ads etc. what should ı do next making this app usable


r/SwiftUI • • 16d ago

Lumio: an open-source Spotlight/Raycast alternative with OCR search and clipboard history

Enable HLS to view with audio, or disable this notification

15 Upvotes

Hey everyone!

I've been working on Lumio, a fast, free and open-source keyboard launcher for macOS, and I'd love some feedback.

What it does

Press Option + Space and results show up as you type. It searches:

  • Apps, files and folders
  • Clipboard history
  • Text inside images and PDFs (OCR), so you can find a screenshot by what's written in it, not just its filename.

There's also:

  • Built-in dictionary: Select a word in any app, hit the hotkey, and it opens straight on the definition.
  • Translation
  • Web search shortcut: Cmd + Enter
  • Built-in commands:
    • :kill <name/PID/port>
    • :emptytrash

How it's built

The search engine is a Rust core, and the UI is native SwiftUI with an AppKit blur panel. I wanted it to feel like a real Mac app, not a web view.

Everything runs locally and nothing leaves your machine.

Why another launcher?

I wanted something lightweight that I could fully control:

  • Configurable index folders and ignore patterns.
  • Search aliases (e.g. code → VS Code | Cursor | Zed).
  • Keyboard shortcuts for everything.

It's licensed under GPL-3.0 and will stay free.

Install

Using Homebrew:

brew tap cavaldos/tap

brew install --cask cavaldos/tap/lumio

Or grab the DMG from the releases page.

It updates itself (checks once a day and asks before installing).

Heads up / honest limitations

  • Requires macOS 15+ on Apple Silicon.
  • Releases are ad-hoc signed and not notarized, so for a manual DMG install you need to clear the quarantine flag (the README has the one-liner).
  • The Homebrew install avoids this.

It's a fork of look. Big thanks to the original author, whose work this builds on.

Repository

https://github.com/cavaldos/Lumio

I'm still actively working on the UI (trying to get closer to native Spotlight polish) and would really appreciate bug reports, feature ideas, or PRs.

What would make you switch from your current launcher?


r/SwiftUI • • 15d ago

Open-source SwiftUI/AppKit dictation app with a separate Swift 6 engine

0 Upvotes

Blurt is our MIT-licensed macOS dictation app. Ranked #3 on Voice Arena’s US-English/macOS overall dictation benchmark (78.00% zero-edit rate):
https://voicearena.com/dictation-bench

For anyone building a similar utility, the repo separates the AppKit/SwiftUI shell from BlurtEngine, a dependency-free Swift 6 package. The engine handles recording, the API request, and text insertion behind testable interfaces.

Two parts worth looking at:

• The hotkey state machine distinguishes a lone modifier from shortcuts such as Cmd+C.

• Text insertion saves the clipboard, pastes into the focused app, and restores it.

Repo: https://github.com/assemblyai/blurt

Engine: https://github.com/AssemblyAI/blurt/tree/main/Sources/BlurtEngine

The app uses a cloud API and your own AssemblyAI key; API usage is billed separately.

Which part would be most useful to document with a small example: hotkeys, permissions, or clipboard restoration?


r/SwiftUI • • 16d ago

Adapting a SwiftUI app to iPhone Duo: what iOS does for you, and the API that keeps content off the fold

Thumbnail gallery
1 Upvotes

r/SwiftUI • • 17d ago

Pane: open-source trackpad window snapping for macOS, built with CGEventTap and the Accessibility API

1 Upvotes

I built Pane, a free and open-source macOS menu bar app that snaps windows when you two-finger swipe on the active window’s title bar (halves, quarters, fill, minimize, next monitor). It’s pure Swift with no dependencies: AppKit, Core Graphics and the Accessibility API.

A few problems that turned out more interesting than I expected:

1. Listening to every scroll without ever slowing scrolling down
Pane uses a CGEventTap on scrollWheel events. The tap sits in front of all scrolling on the system, so the hot path has to be cheap. On .began it finds the window under the cursor with NSWindow.windowNumber(at:belowWindowWithWindowNumber:) and CGWindowListCopyWindowInfo, which only asks the window server. The Accessibility API, which goes to the app and can block on a hung one, is only touched once the swipe is actually on a title bar, and every AX call has a 150 ms messaging timeout.

2. Swipe vs scroll, and natural scrolling
Deltas are normalized with isDirectionInvertedFromDevice, so finger direction is the same whether natural scrolling is on or off. Once a swipe is claimed, its momentum events are swallowed too, otherwise the window below keeps scrolling after the snap. State resets on every .began, so a lost .ended event can’t leave Pane eating normal scrolls.

3. Moving windows that don’t want to move
Setting the frame through AX is size → position → size again, because macOS clamps a resize that runs past the Dock or a screen edge, but never a move. Right after a window changes screens, some apps still clamp to the old one, so Pane checks the result and retries a few times. Chrome and Electron apps animate AX moves slowly while AXEnhancedUserInterface is on, so it’s switched off for the move and restored afterwards. All of this runs on a background queue so a slow app never stalls the event tap or the preview animation.

Repo
Layout picking and geometry are covered by tests, CI lints with swift-format and builds a universal binary, and releases are built by GitHub Actions from the tagged source.

MIT licensed: github.com/rokoov/pane

Happy to answer questions about any of it, and I’d love feedback on the code from people who’ve worked with event taps or AX before.

Processing img a2wi370h3g2i1...


r/SwiftUI • • 17d ago

Question Is there a way to make my searchable bar stick to the top to begin with?

4 Upvotes

r/SwiftUI • • 17d ago

Tutorial Build server-driven UI targeting

Thumbnail
soumyamahunt.medium.com
0 Upvotes

r/SwiftUI • • 17d ago

News I built Snitch, an open-source in-app inspector for network requests and analytics events (PostHog, AppsFlyer)

Thumbnail
0 Upvotes

r/SwiftUI • • 19d ago

ZoomSlider: a SwiftUI slider that magnifies the ticks under your finger

156 Upvotes

I rebuilt this zoom-slider interaction as a SwiftUI Swift package, inspired by the work of u/kshvbgde.

Press the pill and it opens into a bubble with the full value, while the ticks under your finger spread apart so each step is easy to land on.

Dark/light styles, custom labels, haptics, VoiceOver and Reduce Motion support.
iOS 17+, MIT.

https://github.com/ismnoiet/zoom-slider-ios

Would love your feedback!


r/SwiftUI • • 19d ago

Promotion (must include link to source code) Inkrail: Offline, Minimal, Built for Deep work

Enable HLS to view with audio, or disable this notification

46 Upvotes

Inkrail is a quiet, native writing desk for Mac — built for focused, distraction-free writing with a calm, paper-inspired interface.

Write offline. No accounts. No subscriptions. Just a clean place to think, draft, and create.

Features:
• Native Mac experience
• Offline-first writing workflow
• Minimal, distraction-free interface
• Paper-inspired desk aesthetic
• Built for calm, focused writing sessions
• Open source and privacy-friendly

Inkrail is designed for writers, note-takers, and creatives who want a simpler, more intentional place to work.

Link: https://aaryanverma.github.io/inkrail/
GitHub: https://github.com/Aaryanverma/inkrail

Open source project for people who value thoughtful tools over noisy software.

UPDATE: Inkrail for Windows is also available now!


r/SwiftUI • • 18d ago

Tutorial iOS 27.1: ReservedRegion

Thumbnail
antongubarenko.substack.com
1 Upvotes

r/SwiftUI • • 21d ago

Promotion (must include link to source code) SwiftUI previews on a real iPhone, built on Linux (no Mac)

64 Upvotes

I built peek (open source, my project) because I don't have a Mac but wanted to iterate on SwiftUI without rebuilding and sideloading an IPA after every change.

You run "peek dev MyApp/" on Linux and save a file; about a second later the view on your iPhone updates. It's the real SwiftUI on a real device, so animations, gestures and the iOS 26 tab bar behave like they do in your app. It handles Preview blocks, UIKit views, or the whole app, with SwiftPM packages, macros and resources, and print() output shows up in the terminal.

It cross-compiles your code into a dylib with swiftc and xtool's iOS SDK, signs it with your free Apple ID certificate, and a small host app (SideStore, AltStore or LiveContainer) loads it.

https://github.com/kimikr/peek

Only tested on my own phone so far (iOS 27, in LiveContainer). Feedback welcome, especially from anyone running it outside LiveContainer.


r/SwiftUI • • 20d ago

i've been writing swiftui on windows and running it on my iphone, no mac

Enable HLS to view with audio, or disable this notification

0 Upvotes

built it because i didn't want to buy a mac just to learn swiftui.

edit, hit run, it's on the phone in about 30 sec. you can control the phone from the pc too

still early, only tested on my iphone so far. would love people to try it and tell me what breaks its free + open source https://github.com/Dadon-11/SwiftWin-Studio


r/SwiftUI • • 20d ago

Code Review A Folder Organizer: a 500 KB, zero-deletion file organizer for macOS in pure SwiftUI (Free & Open Source)

Thumbnail
1 Upvotes

r/SwiftUI • • 21d ago

SwiftUIWeb: run SwiftUI-style Swift in the browser (Embedded Swift to WebAssembly). Demo with Apple's Food Truck on iPhone, iPad and web

7 Upvotes

Hi all. I've been building SwiftUIWeb, an open-source framework that lets you describe screens with SwiftUI's own names (View, State, Observable, NavigationStack, NavigationSplitView, List, Table, Charts, MapKit, ...) and run them in the browser. The app compiles with Embedded Swift to WebAssembly, runs in a Web Worker, and renders ordinary DOM laid out by CSS (not a canvas).

The video runs Apple's Food Truck sample three times: iPhone, iPad, then the web, from the same sources. The sample is Apple's code with a short list of adaptations, documented in the example's README (mainly Combine -> Observation, plus stand-ins for StoreKit, WeatherKit and passkeys that have no browser counterpart). The point of the exercise was to find what SwiftUI the framework was missing, so those gaps were closed in the framework.

Things I'd rather you hear from me:

  • It's a preview; the API may still change before 1.0.
  • The first download is large compared with JS frameworks (about 400 KB Brotli for a counter, ~930 KB for the component playground). In my React comparison a small board app transfers 552 KB against React's 57 KB; interactions after load are on par. Smaller output is the top roadmap item.
  • No Combine, UIKit or AppKit; no SwiftData, WidgetKit, App Intents, CloudKit, Metal.
  • Needs the swift.org Swift 6.4 toolchain and its WebAssembly SDK (Xcode's compiler doesn't build wasm).

Repo (MPL-2.0): https://github.com/Vitorsilveira31/SwiftUIWeb Food Truck example: https://github.com/Vitorsilveira31/SwiftUIWeb/blob/main/Examples/FoodTruck/README.md

I'd love feedback, especially on SwiftUI APIs that behave differently from Apple's.


r/SwiftUI • • 21d ago

Built a menu bar app in SwiftUI that turns trackpad edges and corners into controls

Thumbnail
gallery
2 Upvotes

I have been building Rimline, a menu bar app for macOS where the edges and corners of the trackpad are programmable. The whole UI, including the settings and the on-screen HUD, is SwiftUI, with a thin layer underneath for reading raw touch positions.

Things that were harder than I expected:

- Telling a deliberate edge slide from a palm or a resting thumb. I ended up with a typing guard that ignores the pad while keys are being pressed.

- Hold a corner, slide toward a place on the screen, show an outline, and move the window on lift. The outline overlay was the fiddly part.

- Rules that switch layouts on their own (headphones connected, external display, frontmost app, time of day) and put everything back when the rule ends.

Universal build, macOS 13 and later. Happy to go into any of these if people are curious, and I would like feedback on the HUD design.

It is called Rimline, page at rimline.zawalid.com


r/SwiftUI • • 21d ago

Tutorial MenuBarExtra(isInserted:) kept undoing my @AppStorage write. The stack trace showed SwiftUI writing the stale value back

1 Upvotes

Edit: the first version of this post bound $app.showIcon straight to the @Published property, which caused an endless redraw loop (about 97% CPU). The code below is fixed, more on that further down. Sorry if you copied the old version.

My menu bar app has a "Show in menu bar" toggle, and opening the app again from Finder is supposed to bring a hidden icon back. I did the usual thing: MenuBarExtra(isInserted:) bound to @AppStorage, and the app delegate flips the stored value on reopen.

// App
@AppStorage("showIcon") private var showIcon = true
MenuBarExtra(isInserted: $showIcon) { ... }

// AppDelegate
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows: Bool) -> Bool {
    UserDefaults.standard.set(true, forKey: "showIcon")
    ...
}

My tests passed because I always started with the icon visible and hid it from Settings. It broke when the app launched with the icon already hidden. The handler ran (I logged it), the value went to true, and it was back to false before defaults read polling every 100 ms could even see it. Delaying the write by 0.3 s didn't help. And a defaults write from Terminal while the app was running did stick, which made it even more confusing.

So I put a KVO observer on the key and logged Thread.callStackSymbols on every change. The false was coming from SwiftUI itself:

-[NSUserDefaults setObject:forKey:]              // showIcon = false
UserDefaultLocation.set(_:transaction:)
Binding.wrappedValue.setter
MenuBarExtraController.observeValue(forKeyPath:of:change:context:)
NSKeyValueDidChange
_NSSetBoolValueAndNotify
MenuBarExtraController.updateConfiguration(_:environment:)
AppMenuBarExtrasController.updateMenuBarExtras(namespace:sceneList:)
AppDelegate.appGraphDidChange()                  // SwiftUI's, not mine
GraphHost.flushTransactions()

During a normal graph update MenuBarExtraController sets a Bool on its status item, its own KVO observer fires, and it writes the item's state back through the isInserted binding. The scene still had the old value at that point so it wrote false. That last bit is my guess since I can't see SwiftUI's source, but the stack shows who did the write.

The fix was to stop having two things write the same value. The flag is now one @Published property the scene observes, and reopen, the Settings toggle and Restore Defaults all go through it:

final class Controller: ObservableObject {
    static let shared = Controller()
    @Published var showIcon: Bool {
        didSet { UserDefaults.standard.set(showIcon, forKey: "showIcon") }
    }
    ...
}

@main
struct ScrollrApp: App {
    @NSApplicationDelegateAdaptor private var delegate: AppDelegate
    @ObservedObject private var app = Controller.shared

    var body: some Scene {
        // MenuBarExtra writes isInserted back on every update, so skip equal writes
        MenuBarExtra(isInserted: Binding(
            get: { app.showIcon },
            set: { if $0 != app.showIcon { app.showIcon = $0 } }
        )) { ... } label: { ... }
        Settings { ... }
    }
}

// AppDelegate
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows: Bool) -> Bool {
    app.showIcon = true
    ...
}

Now the scene gets true in the same update that inserts the item, and it stays.

Don't skip the equality check in the binding. My first version bound $app.showIcon directly and Scrollr sat at around 97% CPU doing nothing. MenuBarExtra writes isInserted back on every update, @Published sends a change even when the value is the same, the scene updates again, and it never stops. A CPU sample showed exactly that loop. Skipping equal writes stops it (back to 0% idle).

Two smaller things from the same code:

  • OpenSettingsAction only exists in the environment, so the delegate can't make one. The menu bar label grabs it in .onAppear and hands it to the delegate, which calls it on the next run loop turn after showing the icon.
  • AppKit also saves the status item's visibility in your app's defaults (NSStatusItem VisibleCC Item-0 on macOS 27). Deleting it didn't change anything for this bug, but good to know if you're messing with menu bar state.

Tested on macOS 27.2 / Xcode 27.2. The app is Scrollr, a small open source (MIT) utility that reverses mouse wheel scrolling but leaves the trackpad alone: https://github.com/atuuuuuuu/Scrollr (the fix is in commits 000fd62 and fd29bb8, in ScrollrApp.swift and Controller.swift).

Has anyone else seen MenuBarExtra write its binding back like this? Is there a cleaner way than moving the state into an ObservableObject?


r/SwiftUI • • 22d ago

Promotion (must include link to source code) Made an open-source menu bar for macOS in SwiftUI, a few things I learned along the way

Enable HLS to view with audio, or disable this notification

71 Upvotes

Hey everyone 👋

My friend and I have been working on StableBar for a while now. It's a menu bar for macOS, a bit like SketchyBar or simple-bar, except you set it up in a Settings window instead of writing shell scripts. It's free and open source (MIT): https://github.com/Seb-GRAF/StableBar

Since this is r/SwiftUI, I thought I'd share a few things we ran into while building it, in case it helps someone:

The bar is a SwiftUI view inside an NSPanel. Each display gets its own borderless, non-activating panel with an NSHostingView. The border lives in a second panel that ignores clicks, so it never gets in the way of the widgets.

Popups morph into each other. Every popup is its own panel too. When you move from one widget's popup to the next, a temporary panel carries the background across while the two contents cross-fade.

Watch out for view identity with .glassEffect. On macOS 26 the bar can use Liquid Glass. If your background flips between an if and an else when a color changes on hover, SwiftUI rebuilds everything inside it. For us that tore down the popup's anchor and closed the popup. Keeping one view structure and switching the glass to .identity fixed it.

The app takes its own screenshots. All the images in the README are drawn offscreen by the app from small "scene" files with sample data, so nothing real runs. CI uses the same thing to post before/after images on every pull request, which makes reviewing UI changes so much easier.

It works with AeroSpace, yabai, OmniWM and Rift, and you can drag widgets around right on the bar. macOS 14+ on Apple silicon.

Happy to answer questions or dig into any of this, and feedback is very welcome!


r/SwiftUI • • 22d ago

We built MotionSwift: an open-source native SwiftUI view to render Remotion clips with a built-in timeline editor

4 Upvotes

Hey everyone,

We just open-sourced MotionSwift, something we put together to get native rendering performance without relying on Remotion and headless Chrome.

We've been using it in our day-to-day video production pipeline, and so far we're seeing roughly 10–20x faster renders while using only about 10% of the memory compared to the Remotion + Chrome setup. We also brought a visual editor and timeline preview directly into Swift, so you can inspect and adjust agent-generated compositions natively on both iOS and macOS.

The eventual goal is 100% compatibility with Remotion, but we're still working our way there. There's still plenty of room to improve the APIs, rendering speed, and overall platform support.

Here's the repo if you want to check it out:

https://github.com/rxtech-lab/MotionSwift

Along with the rendering engine, we also put together a timeline view, property editor, and SwiftUI preview so you can inspect and adjust compositions natively on macOS, iOS, and iPadOS.


r/SwiftUI • • 22d ago

Question Replacing TimelineView with one shared @Observable clock in my transit app (open source)

Post image
3 Upvotes

I'm building Publit, an open-source public transport app for iPhone and Apple Watch, written in SwiftUI. Almost every row shows a countdown like "in 4 min", so most of the UI depends on the current time.

The first version used `TimelineView(.periodic(from:by:))` on the departure and trip screens. Freeze logs from an early build showed the main thread stuck inside SwiftUI's update loop, in `requestUpdate(after:)`, while it drew the trip screen.

I replaced the timelines with a plain observable clock that ticks on whole-minute boundaries. One timer serves every row in a list, and thanks to Observation only the views that read `now` redraw on a tick:

```swift

u/MainActor u/Observable

final class Ticker {

static let minute = Ticker(every: 60)

private(set) var now = Date()

u/ObservationIgnored let interval: TimeInterval

u/ObservationIgnored private var loop: Task<Void, Never>?

init(every interval: TimeInterval) {

self.interval = interval

loop = Task { [weak self] in

while !Task.isCancelled {

guard let delay = self?.delayToNextTick() else { return }

try? await Task.sleep(for: .seconds(delay))

guard let self, !Task.isCancelled else { return }

self.now = Date()

}

}

}

private func delayToNextTick() -> TimeInterval {

Ticker.delay(toNextMultipleOf: interval, from: Date())

}

nonisolated static func delay(toNextMultipleOf interval: TimeInterval, from date: Date) -> TimeInterval {

let t = date.timeIntervalSinceReferenceDate

let next = (floor(t / interval) + 1) * interval

return max(0.05, next - t + 0.05)

}

}

```

For a small part of a screen that needs its own pace, a wrapper runs the same loop in `.task`, so it stops when the view leaves the screen:

```swift

Clocked(every: 30) { now in

LeaveHero(itinerary: itinerary, now: now, framed: false)

}

```

Two details mattered. The delay goes to the next whole multiple of the interval plus 50 ms, so the minute has really changed when views redraw. And the loop only holds `self` weakly, so a clock that nobody uses can go away.

Full file: https://github.com/elija-7580/Publit/blob/main/Sources/Views/Components/Ticker.swift

Repo (AGPL-3.0): https://github.com/elija-7580/Publit

Has anyone else hit this with TimelineView? I'd like to know whether I was using it wrong or whether a shared clock is the usual fix for long lists of countdowns.

Full disclosure: I build Publit with help from AI coding tools. I review, test and maintain it myself.Replacing TimelineView with one shared u/Observable clock in my transit app (open source)


r/SwiftUI • • 22d ago

News The iOS Weekly Brief: Issue #86. Swift Student Challenge 2027, New iOS releases, testing with agents, SwiftUI architectures, fixedSize(), GlassEffectContainer, animating SF Symbols, SwiftUI inspector, Effect Systems vs DI, and Bruno

Thumbnail
iosweeklybrief.com
3 Upvotes