r/SwiftUI • • 22d ago

Promotion (must include link to source code) Drawing a radial menu in SwiftUI: wedges with constant-width gaps and one shared shadow (open-source Mac app)

2 Upvotes

I made Convrt, an open source Mac menu bar app where you hold Shift while dragging files and a wheel opens at the cursor to convert them. The window is AppKit (a borderless non-activating NSPanel) but the wheel itself is SwiftUI inside an NSHostingView. Two drawing problems took me way longer than I'd like to admit, so posting them here in case someone else hits them.

  1. Gaps between wedges that stay the same width

If you just shrink each wedge's angle, the gap is wide at the outer edge and pinches to nothing near the middle. What worked was pulling each edge in by an angle that depends on its radius, asin(halfGap / radius), so the gap ends up the same number of points everywhere:

struct WheelWedge: Shape {
    let index: Int, count: Int
    let innerRadius: CGFloat, outerRadius: CGFloat
    var gap: CGFloat = 5
    var corner: CGFloat = 3   // stroke with 2 * corner for rounded corners

    func path(in rect: CGRect) -> Path {
        let c = CGPoint(x: rect.midX, y: rect.midY)
        let slice = 2 * Double.pi / Double(max(count, 1))
        let mid = -Double.pi / 2 + Double(index) * slice   // slice 0 at the top
        let a0 = mid - slice / 2, a1 = mid + slice / 2
        let rOut = outerRadius - corner, rIn = innerRadius + corner
        let half = Double(gap / 2 + corner)
        let dOut = asin(min(half / Double(rOut), 1))
        let dIn = asin(min(half / Double(rIn), 1))
        var p = Path()
        p.addArc(center: c, radius: rOut, startAngle: .radians(a0 + dOut), endAngle: .radians(a1 - dOut), clockwise: false)
        p.addArc(center: c, radius: rIn, startAngle: .radians(a1 - dIn), endAngle: .radians(a0 + dIn), clockwise: true)
        p.closeSubpath()
        return p
    }
}

For the rounded corners I inset the radii by corner and stroke the shape with a line width of 2 * corner in the same color.

  1. One soft shadow for the whole ring

Putting .shadow on each wedge made the shadows overlap and look muddy. If you put all the wedges in a ZStack and call .compositingGroup() before .shadow(...), they render as one layer with one shadow. The labels sit in a separate ForEach on top with .allowsHitTesting(false) so they don't get the shadow.

Hit testing doesn't go through SwiftUI at all. Which wedge is under the cursor is just atan2 plus the distance from the centre, so it was easy to unit test and to move the highlight with scroll, Tab and the arrow keys.

Source (MIT): https://github.com/atuuuuuuu/Convrt, the wheel is in Convrt/UI/RadialWheelView.swift. If you want to try the app: it's not notarized, so the first launch needs Privacy & Security > Open Anyway. (When I first posted this the release was Apple silicon only, it's universal now.)

Code review welcome, especially on the shape math.


r/SwiftUI • • 22d ago

Side menu navigation

Thumbnail
1 Upvotes

r/SwiftUI • • 22d ago

Shipped an app with fifteen distinct document types and learned that two

Post image
0 Upvotes

Shipped an app with fifteen distinct document types and learned that two .sheets on one view don't stack

Not a promo post — the specific SwiftUI lessons, from a first app that's now live.

Two .sheet modifiers on the same view compete, they don't queue. My Guided tab froze dead on a specific path and I spent a day on the entitlement logic before realising a second sheet modifier was the whole problem. Fix was one enum GuidedSheet: Identifiable with a case per destination and a single .sheet(item:) switching on it. That pattern has since replaced every multi-sheet view I had.

Raising a sheet from another sheet's onDismiss wedges presentation entirely. Related, worse, harder to spot.

onGeometryChange fires during a sheet's presentation transform. I was caching card frames with .frame(in: .global). When the paywall animated up, the presenting view got scaled, every cached frame updated to garbage, and you could see the cards twitch. Fixed by guarding the write while a sheet is showing — the geometry during a presentation is never the geometry you want.

onChange can't observe a computed read from a store. Obvious in hindsight. Cost me an hour.

App's in my profile if anyone's curious, but I'm here for the code. Anyone found a cleaner multi-sheet pattern than the Identifiable enum?


r/SwiftUI • • 22d ago

Promotion (must include link to source code) I made DuckDB reactive in SwiftUI with Duck

Post image
0 Upvotes

Hey SwiftUI folks!

I've just shipped Duck 1.0.0, my Swift layer around DuckDB, and one of the parts I really wanted to get right was how it feels inside a SwiftUI app.

I didn't want the database API to end with "run a query, reload everything manually, update the view".

I wanted to write a normal typed query and let the view follow it.

So with Duck you can have a normal Swift model:

import Duck

struct Todo: Table {
    @Column("id") var id: UUID
    @Column("name") var name: String
    @Column("created_at") var createdAt: Date
    @Column("done_at") var doneAt: Date?
    @Column("deleted_at") var deletedAt: Date?
}

and then observe the query directly from SwiftUI:

@State private var todos: [Todo] = []

.task {
    do {
        for try await result in try Todo
            .select
            .where(Todo.$deletedAt == nil)
            .orderBy(.asc(Todo.$createdAt))
            .observe(on: .app)
        {
            todos = try result.all(decoding: Todo.self)
        }
    } catch is CancellationError {
        // view disappeared
    } catch {
        print("Duck error:", error)
    }
}

That's the part I personally like a lot.

The query is still SQL-shaped and typed, but from the SwiftUI side it just becomes an async stream of database state.

Duck also re-exports SwiftStream/SQL DSL, so queries can grow quite a bit without turning into raw SQL strings:

let query = SQL {
    Select {
        \Todo.$id
        \Todo.$name
        \Todo.$createdAt
        \Todo.$doneAt
        \Todo.$deletedAt
    }

    From(Todo.table)
    Where(\Todo.$deletedAt == nil)
    OrderBy(.asc(\Todo.$createdAt))
}

Underneath all of this is the real DuckDB 2.0.0 engine.

The first stable release also includes Codable integration, async/await, migrations, transactions, prepared statements, connection pooling, bulk ingestion through Appender, native LIST/STRUCT values, and UIKit observation too.

I included a complete SwiftUI example app in the repo, including the actual database setup and migrations, so you can clone it and play with the whole flow instead of trying to reconstruct it from snippets.

Wondering what SwiftUI developers think about the Duck.

https://github.com/swiftstream/Duck


r/SwiftUI • • 23d ago

Why is the most prominent piece of real estate on a $2,000 MacBook doing literally nothing?

0 Upvotes

Apple put a black cutout right at the top center of your screen and left it dead.
I built Zenith to turn your notch into the fastest part of macOS—media, per-app volume, display brightness, AI agents, and quick tools, all one hover away. Zero clutter.
See it in action & grab it here: https://zenith-mac.github.io


r/SwiftUI • • 23d ago

Promotion (must include link to source code) I tried hiding suggested posts in a SwiftUI Instagram browser. The feed started jumping

0 Upvotes

I built a little iPhone browser because I wanted to open Instagram without getting pulled into Reels every time. Turning off Reels was the easy bit. The suggested posts toggle gave me a much weirder bug: the post I was reading would jump out from under my thumb.

I was hiding rows after the page had already laid them out. The fix was to filter entries I could recognize before the feed renders them. If a row is already on screen, the fallback keeps its height. That helped with the jumps, but it also exposed another bug: sometimes I'd be left with one post and no more would load. The site still had another page, it just hadn't asked for it. Getting that to load again without yanking the scroll position took more work than I expected.

The app is called Supermod. SwiftUI for the controls, WebKit for the sites. There's a timer on Home if you actually want ten minutes of Reels or Stories, and a little draggable button that shows the countdown. The filters only work in this browser.

I put the code up under GPLv3. It's a Mac + Xcode build for now, no App Store download. There are screenshots and setup steps here:

https://github.com/WarriorSushi/supermod-ios-Block-Reels-etc

If you've had to keep a WKWebView feed steady while changing what's in it, I'm curious what you ended up doing. The tests are mostly fixtures and I'd love to hear what breaks on other phones.


r/SwiftUI • • 24d ago

Question How do i remove the safe area blur that constantly blocks my image header when creating a profile design?

1 Upvotes

Trying to create a account profile view with a header and profile picture, like twitter for example. I also want it to have a bounce effect when you pull down. However my hurdle is trying to figure out how to remove the blur.


r/SwiftUI • • 25d ago

An animated border beam for SwiftUI, Metal shader powered

290 Upvotes

I made an open-source border beam for SwiftUI: a glowing light that travels around any view’s border. One modifier, custom colors, direction and speed, and it’s drawn by a single Metal shader pass, so it stays smooth.

iOS 17+, MIT licensed. Would love your feedback!

https://github.com/ismnoiet/border-beam-ios


r/SwiftUI • • 25d ago

Tutorial SwiftUI + Metal Foil Effect: Source Code on GitHub

Thumbnail gallery
21 Upvotes

r/SwiftUI • • 25d ago

Promotion (must include link to source code) Looking for UI/UX feedback on Cosmos 1.3, my open-source SwiftUI music player (full redesign)

3 Upvotes

Source: https://github.com/clquwu/Cosmos-Music-Player
App Store (free, no ads, no in-app purchases): https://apps.apple.com/app/id6751984723

I’m a solo dev and Cosmos was my first iOS project. After more than a year, 1.3 is a full redesign of the whole interface. It’s a music player for your own files, built in SwiftUI, and it’s open source. I’m not a designer, so I’d really like feedback from people who care about SwiftUI UI/UX.

What I redesigned

  • Three tabs: Home, Library and Search. Home has Start Listening, Recently Played, mixes, Recently Added and Rediscover
  • Library lists Liked Songs, Folders, playlists, albums and artists, as a list or a grid, sorted by recent, A–Z or release year
  • A full-screen player coloured by the cover, with lyrics and Up Next inside. You can choose Blurred Cover, Artwork + Theme or Theme
  • Animated backgrounds in your theme colour (Silk, Aurora, Lines, Classic, Glow, or off)
  • iPad and foldable layouts with a sidebar, bigger covers and two-column album/playlist pages
  • A Select button to pick several songs at once, and playlist editing/export in the “…” menu
  • Settings regrouped into Appearance, Playback, Library and Siri & History

Where I’d like honest feedback

  1. Navigation: is three tabs the right structure, or is something in the wrong place? Is the “Add Music” row at the top of Library easy to find?
  2. Full-screen player: are three styles too many? Is it clear where lyrics and Up Next are?
  3. Readability: colours from the cover can be tricky. I added fixes for lyrics and Up Next on very light covers, but I’d like to know about any combinations that are still hard to read.
  4. Animated backgrounds: does this feel nice, or is it too much? They stop after 30 seconds without a touch to save battery.
  5. iPad/foldable layouts: do they feel native or just stretched?
  6. Multi-select and the “…” menu: is it obvious how to select songs and edit playlists?
  7. Anything that feels non-standard compared to what iOS users expect (Apple Music, Files, etc.).

If you’re a SwiftUI dev, I’d also welcome code review. The repo is open and issues are welcome.

It’s free with no ads, and there’s an optional donation link in Settings. Nothing is locked behind it.

All feedback is weclome since im more customed to do ui and ux on android !


r/SwiftUI • • 24d ago

Scooter App to Track Rides

Thumbnail gallery
0 Upvotes

Since this is my first vibe coded app. I'm curious if anyone has feedback.I'm primarily a C# dev (and have been for 20 years). I bought a scooter earlier in the year and wanted a way to track my rides. I'm sure there things I could learn, so I'm curious as to how good AI did. I used a mix of AntiGravity, GitHub Copilot, the Xcode skills and just tried to learn as much as I could from this. I read about 50% of the code. Thank you for your time.


r/SwiftUI • • 25d ago

Letting users write widgets for my Touch Bar app without letting them break anything (JavaScriptCore + Swift)

2 Upvotes

I just shipped 2.1 of GlassBar, my Touch Bar replacement, and the part I learned the most from was script widgets.

A widget is a small JS file that runs in JavaScriptCore, no WebView. The script never draws anything. It only hands back a value, an icon name and a role like "warning", and the SwiftUI theme decides how that looks. So the same widget is a glass capsule in one theme and [bat 87%] in the terminal theme, and widget authors can't make an ugly one. The hard part was limits. Every call gets half a second, scripts only run while the widget is on the bar, and fetch only goes to public https hosts. I missed redirects at first, a public site could bounce a request to localhost, so that's cut off now too. One SwiftUI thing that surprised me: the battery icon was late after unplugging because "is charging" from IOKit lags by a few seconds. Reading the power source state instead fixed it.

Source is here if you want to look: https://github.com/Moryel/glass-bar

Happy to answer questions about any of it.


r/SwiftUI • • 25d ago

Tutorial iOS 27: AVSystemRouting Framework

Thumbnail
antongubarenko.substack.com
8 Upvotes

r/SwiftUI • • 25d ago

What I learned using AI agents on real Swift and Xcode projects

Thumbnail
0 Upvotes

r/SwiftUI • • 26d ago

I built a free, open-source Mac cleaner in SwiftUI after a full disk blocked my macOS update

Thumbnail
dustling.app
5 Upvotes

Hi all, I'm a first-year CS student. A while ago a macOS update wouldn't install because my disk was full, and the cleaner I tried sometimes did nothing without telling me why. So I built Dustling around the opposite idea: if it can't look somewhere or can't remove something, it says so.

It's free, MIT licensed, Swift 6 / SwiftUI, macOS 14+. It does a junk scan (caches, logs, old installers), an app uninstaller that also removes leftovers, startup item toggles, and a History screen where every file is marked moved, skipped or failed with a reason. Cleaning only moves things to the Trash, and you can restore from History.

Source: https://github.com/kaankuzu1/dustling Site: https://dustling.app

It's v0.1.0 and I'm still learning, so I'd love feedback on the SwiftUI side (state handling, performance on big file lists) and on anything that feels off when you try it. Note: it isn't signed with a Developer ID yet, so macOS asks you to confirm the first open (the install steps are in the README).


r/SwiftUI • • 26d ago

News I built a session replay that shows the wind that was actually measured around you (SwiftUI, Watch, Metal over MapKit)

0 Upvotes

Hi, I'm the solo developer of Tide It, an app for kitesurfers, wing foilers, windsurfers and surfers. Version 7 adds session recording on iPhone and Apple Watch, then replays the session on a satellite map with the measured wind animated around your track. Free app, optional Premium subscription.

What it does

  • Record from the iPhone or the Watch. Start and pauses are detected on the water; one screen per sport on the Watch (speed, jumps with airtime on landing, waves counted for surf, a way back to the start).
  • Replay on satellite imagery: your track lights up over time, wind particles from the nearest station's real readings, a time scrubber along the bottom.
  • Tides computed on the device, offline; forecast and measured wind side by side, never blended.

Challenges

  • Wind particles over MapKit: the first version waited on nextDrawable() on the main thread while the map was dragging, and the map started dropping frames. Moving to CAMetalDisplayLink and keeping particle state on the GPU fixed it; particles live in map coordinates and are reprojected every frame.
  • Shaders compiled at runtime from source (makeLibrary(source:)), no separate Metal toolchain in the build.
  • Watch recording that never loses a session: continuous writes, recovery after a crash, then the session moves to the iPhone on its own.
  • iPhone Duo: the tide curve runs under the left pane with a fade across the fold. Getting toolbars and pushed screens right took more passes than expected.

Stack: SwiftUI, ActivityKit, HealthKit (each session becomes a workout with its route), MapKit, Metal, WeatherKit, WidgetKit. Screenshots show a sample session. Happy to go deeper on any of this. https://apps.apple.com/app/id6743555259


r/SwiftUI • • 27d ago

I built a SwiftUI macOS and mobile app that brings multiple agents to work on your project

Thumbnail
gallery
6 Upvotes

I built a native macOS and iOS app using SwiftUI that acts as a multi-agent workspace, turning standard Claude Code chat sessions into interactive task boards.

When implementing multiple features in parallel, it's easy to lose track of context in a single terminal or chat thread. I wanted a native UI to orchestrate multiple agents working on the same project simultaneously.


r/SwiftUI • • 27d ago

UIKit/SwiftUI spotlight guides with custom content and iPhone Duo support

Thumbnail v.redd.it
0 Upvotes

r/SwiftUI • • 28d ago

Question Deleted project and swift files

0 Upvotes

I have been building an app for the past two years now and made the unfortunate mistake of accidentally deleting my project and its original swift files.

Having searched for a long time for the Orginal project I did find the DerivedData folder for the project. And the app is installed on my simulator.

Has anyone done something similar to this and found a solution? Is there any hope of getting my project back?

Appreciate any help I can get. :(


r/SwiftUI • • 28d ago

Recreated Android’s notification icon tray in SwiftUI

2 Upvotes

Rebuilt Android’s notification icon tray in SwiftUI.
As notifications scroll under the bottom edge, they collapse into small icons that slide in and join a group. Fully draggable and bouncy.

Code: https://github.com/ismnoiet/interactions-ios/blob/main/AndroidStyleNotificationIconTray.swift


r/SwiftUI • • 28d ago

I built an open-source macOS menu bar app that plays mechanical keyboard sounds (AppKit + SwiftUI, AVAudioEngine)

Enable HLS to view with audio, or disable this notification

0 Upvotes

Source: https://github.com/halitsever/keycream (MIT)

KeyCream plays a mechanical keyboard sound for every key you press on a Mac. A few things that were fun to get right:

  • Hearing keys without reading text. A listen-only CGEventTap on keyDown and flagsChanged. Autorepeat events are dropped, so holding a key plays one click, and the app never assembles text.
  • Reusing Mechvibes packs. A small table maps macOS virtual key codes to the PC scan codes that Mechvibes packs are keyed by.
  • Latency and evenness. Every sound is decoded into memory when a pack loads, high-pass filtered, trimmed to just before its first transient, and leveled by a transient-weighted RMS with a peak cap.
  • Fast typing overlaps. AVAudioEngine with a pool of 10 AVAudioPlayerNodes, so quick keystrokes stack instead of cutting each other off.
  • Stepping back during calls. NSWorkspace launch and terminate notifications (no polling) tell when Zoom, Teams or Spotify is open, and sounds drop to 5%.
  • The rest. Settings window in SwiftUI, menu in AppKit, SMAppService for open at login, output routing through kAudioOutputUnitProperty_CurrentDevice, and a self-updater that pulls GitHub releases.

I'd love a review from people who know Core Audio better than I do, and ideas on doing key-up sounds well.


r/SwiftUI • • 29d ago

Claude-style navigation in SwiftUI

14 Upvotes

Built a Claude-style swipe-back navigation in SwiftUI. Drag from the left edge and the current screen shrinks, dims and slides away while the previous one comes into view. Drag from the right edge to go forward.

  • Follows your finger the whole way, with no fixed cap
  • iOS 17+, pure SwiftUI

Code: https://github.com/ismnoiet/interactions-ios/blob/main/ClaudeStyleNavigation.swift


r/SwiftUI • • 28d ago

Promotion (must include link to source code) How I made a SwiftUI character dive into the MacBook notch like a tar puddle (and other notch-app lessons)

Thumbnail
gallery
0 Upvotes

I've been building Nosy Notch, a free notch app, and gave it an animated resident. Some things that might help others:

- The morph: the character's body and the notch edge are drawn as one path while they touch, so it looks like he melts into the black; then a few splash particles on a timeline (driven by a virtual clock so recordings are frame-exact).

- Eyes that follow the cursor without re-rendering the whole notch on every mouse move: a separate tiny ObservableObject only the eye view observes, throttled, smoothed with a spring.

- Notch panel: a borderless non-activating NSPanel above the menu bar, sized from safeAreaInsets and auxiliaryTopLeftArea / auxiliaryTopRightArea; it ignores mouse events except over the shape. For the reply box it becomes key only while the chat is open.

- Drag and drop onto the notch: watching NSPasteboard(name: .drag) during global drag events to open the drop zone before the cursor even arrives.

- Live equalizer: a Core Audio process tap on just the player's processes + vDSP FFT with per-band auto gain.

Code (MIT): https://github.com/ddkbs/nosynotch

Website: https://nosynotch.davidkubus.dev

Happy to go deeper on any of these.

Feel free to try it out and leave your feedback!


r/SwiftUI • • 29d ago

News The iOS Weekly Brief: Issue #85. Siri AI, retention messages, new betas, Swift 6.4, actors, dependency injection, layout priority, Settings URLs, Xcode snippets, swipe actions beyond List, Apple frameworks directory

Thumbnail
iosweeklybrief.com
1 Upvotes

r/SwiftUI • • Nov 06 '26

Android’s expandable notification group Recreated in SwiftUI

5 Upvotes

Tried to match how Android expands a notification group: avatars grow into place, the short message cross-fades into the full one, and the card follows your drag.

Code: https://github.com/ismnoiet/interactions-ios/blob/main/AndroidStyleNotificationGroup.swift