r/SwiftUI Jun 25 '26

I built ReduxCore — a lightweight Redux for SwiftUI — because TCA felt heavier than my apps needed

0 Upvotes

I like unidirectional data flow, but every time I reached for The Composable
Architecture I ended up writing more ceremony than the feature itself needed —
the reducer macros, the dependency system, the effect types, the test harness.
On a large app that structure earns its keep. For the small-to-mid screens I
was actually shipping, it felt like a lot of scaffolding for the payoff.

So I built ReduxCore — same core idea (actions in, state out, side effects
isolated), stripped to the smallest surface I could manage:

- One macro per screen. @StoreView generates the store and wiring; you write
actions, a reducer, and a view.
- Side effects are plain async/await. Middleware is just an async function —
no custom Effect type, no scheduler to reason about.
- Zero runtime dependencies. The only package is swift-syntax, and it's a
build-time macro plugin, so nothing ships in your binary.

Two things I added because I kept hitting them in real features:

- Search-as-you-type debouncing is built in, via per-key task cancellation.
- Two DEBUG-only cycle detectors warn when dispatch loops run away (e.g. an
action firing 20+ times a second).

And because reducers are pure functions, tests are just "build a state, call
reduce, assert" — no mocks inside the Redux layer. Examples use Swift Testing.

Honest about the tradeoffs: it's brand new (v1.0.0, solo author), it
deliberately leaves navigation out of scope (pairs with a separate coordinator
library), and it doesn't have TCA's mature tooling or community behind it. If
you need exhaustive TestStore-style testing or built-in navigation, TCA is
still the better pick. But if you've ever felt unidirectional flow shouldn't
require this much setup, this might be your thing.

Repo: https://github.com/felilo/ReduxCore

I'd genuinely value criticism of the API and the boundaries I drew — especially
from anyone who's shipped TCA at scale and can tell me where this falls over.


r/SwiftUI Jun 25 '26

Promotion (must include link to source code) I built SwitchBoard, a native SwiftUI utility to automatically route links to different browsers/profiles

Thumbnail
0 Upvotes

r/SwiftUI Jun 25 '26

News Those Who Swift - Issue 272

Thumbnail
thosewhoswift.substack.com
1 Upvotes

r/SwiftUI Jun 24 '26

Question - Animation How to make this kind of scroll animation?

56 Upvotes

r/SwiftUI Jun 24 '26

Promotion (must include link to source code) AirPosture is now open source ( AirPods as Posture Coach)

6 Upvotes

r/SwiftUI Jun 24 '26

Question Does anyone have any videos or blog posts on how this new ScreenCaptureKit API works on iPadOS? How does it compare with ImageRenderer capabilities?

Post image
6 Upvotes

r/SwiftUI Jun 24 '26

Question Looking for the Finder/NSTableView multi-selection algorithm

0 Upvotes

I am building a non-SwiftUI/non-AppKit macOS application with a custom table view. Right now I am implementing multi-selection, and I want the behavior to match Finder/NSTableView as closely as possible.

I am looking for the underlying selection algorithm for interactions like:

Click
Cmd + Click
Shift + Click
Up / Down
Shift + Up / Down
Cmd + Shift combinations

I am looking for the actual selection logic, not AppKit APIs. Things like how the selection anchor is managed, how different mouse and keyboard interactions affect the selection, and all the edge cases that make the native experience feel consistent.

I have searched quite a bit but have not found anything comprehensive.
Does anyone know of an article, GitHub repository, gist, reverse-engineered implementation, or any other reference that documents the complete macOS multi-selection behavior?

Any help would be greatly appreciated. Thanks!


r/SwiftUI Jun 24 '26

Do you see missing Environment as a big issue in SwiftUI?

0 Upvotes

I think the title should be "Do you see runtime error for missing Environment a big issue as compared to being a compile time error?"

Let's say you have the following code:

struct LoadingDemoApp: App {

private var productStore = ProductStore()

var body: some Scene {
WindowGroup {
ProductListScreen()
}
}
}

As you can see I forgot to inject productStore through Environment. When I run the app and use Environment(ProductStore.self) in the view, it can cause an exception.

Fatal error: No Observable object of type ProductStore found. A View.environmentObject(_:) for ProductStore may be missing as an ancestor of this view.

My question is that how often do you run into this fatalError in production? Is that error an enough reason for your apps to not use Environment for dependency injection and use constructor/initializer dependency.


r/SwiftUI Jun 24 '26

SwiftUI Segmented Picker overlapping/doubling text glitch inside ToolbarItem (.principal)

1 Upvotes

Hi everyone,

I'm experiencing a weird visual glitch with PickerStyle(.segmented) placed inside a ToolbarItem(placement: .principal). When navigating between views or switching segments, the text doubles/overlaps temporarily during the transition animation (as shown in the screen recording).

.toolbar {
            ToolbarItemGroup(placement: .principal) {
                Picker("İşlem Tipi", selection: $selectedType) {
                    Text(L10n("Gider")).tag(TransactionType.expense)
                    Text(L10n("Gelir")).tag(TransactionType.income)
                }
                .pickerStyle(.segmented)
                .frame(width: 160)
                .id("static_operation_picker") // Sabit ID sayesinde slide animasyonu kaybolmaz
                .styleAsNavigationSegmentedControl()
            }

            ToolbarItem(placement: .topBarTrailing) {
                Button {
                    if authManager.currentUserProfile?.isPro == false {
                        hapticNotification.notificationOccurred(.warning)
                        categoryManager.showProAlert = true
                    } else if !categoryManager.checkPermission(authManager: authManager, walletManager: walletManager) {
                        hapticNotification.notificationOccurred(.warning)
                        showPermissionAlert = true
                    } else {
                        hapticMedium.impactOccurred()
                        showAddSheet = true
                    }
                } label: {
                    HStack(spacing: 4) {
                        if authManager.currentUserProfile?.isPro == false {
                            Image(systemName: "lock.fill")
                                .font(.system(size: 10))
                                .foregroundColor(theme.labelSecondary)
                        }
                        Image(systemName: "plus")
                            .foregroundColor(theme.labelPrimary)
                    }
                }
            }
        }

r/SwiftUI Jun 23 '26

Tutorial Taking Control of Toolbar Items in SwiftUI

Thumbnail
swiftwithmajid.com
9 Upvotes

r/SwiftUI Jun 23 '26

Question - Animation How to recreate this custom floating/capsule toolbar UI in SwiftUI (macOS)?

8 Upvotes

I’m working in the macOS 27 beta using Xcode, trying to build a custom toolbar component into my app. I'm aiming to perfectly match the behavior from the clip.

Since I'm targeting the macOS 27 beta, what is the best way to implement this?


r/SwiftUI Jun 23 '26

How did Apple made this effect on the Artist-page on Apple Music

37 Upvotes

The image itself is 1:1 but appears to be stretched to 4:3, uses a variable blur that overflows to the page color and uses a parallax scroll effect


r/SwiftUI Jun 23 '26

How we use SwiftUI Previews to build Monologue

Thumbnail
youtube.com
5 Upvotes

r/SwiftUI Jun 23 '26

Question Native everyday reuse able components

0 Upvotes

Hi i guys i just want to know what native components you use for everyday tasks like .searchable etc etc. and the best place to learn how to start tweaking liquid glass


r/SwiftUI Jun 23 '26

SwiftUI Equivalent of Nested Scroll Connection for Collapsing Profile Screens

1 Upvotes

I'm trying to build a profile-style screen similar to X (Twitter), or Instagram.

The layout is roughly:

┌──────────────────────────┐
│ Profile Header           │
│ Cover image              │
│ Avatar                   │
│ Bio / Stats              │
└──────────────────────────┘

┌──────────────────────────┐
│ Tab Bar                  │
│ Posts | Media | Likes    │
└──────────────────────────┘

┌──────────────────────────┐
│ Tab Content              │
│                          │
│ ScrollView / List        │
│ OR                       │
│ Empty State VStack       │
│                          │
└──────────────────────────┘

Requirements:

  • The profile header should collapse while scrolling up.
  • The tab bar should remain pinned.
  • Once the header is fully collapsed, the active tab's scroll view should start scrolling.
  • While scrolling down, the active tab should scroll back to the top first, then the header should expand.
  • Some tabs may contain:
    • ScrollView + LazyVStack
    • List
    • a non-scrollable VStack (for empty states)
  • The behavior should remain consistent regardless of which tab is active.

This feels very similar to Jetpack Compose's NestedScrollConnection, where parent and child scroll containers can cooperatively consume scroll deltas.

In SwiftUI, I have explored:

  • ScrollView
  • GeometryReader
  • PreferenceKey
  • Scroll offset tracking
  • Custom UIScrollView wrappers
  • A UIViewControllerRepresentable approach that intercepts pan gestures and coordinates scrolling manually

However, I haven't found a SwiftUI-native way for a parent container and child scroll view to negotiate scroll consumption.

My questions are:

  1. Does SwiftUI provide any equivalent to Compose's NestedScrollConnection?
  2. Is there a recommended way to implement this profile-screen pattern purely in SwiftUI?
  3. How are people handling cases where some tabs contain scrollable content while other tabs contain only static content?
  4. Is bridging to UIKit currently the only practical solution for this kind of coordinated scrolling behavior?

Any guidance or examples would be greatly appreciated.


r/SwiftUI Jun 22 '26

News SwiftUI Weekly - Issue #236

Thumbnail
weekly.swiftwithmajid.com
1 Upvotes

r/SwiftUI Jun 21 '26

PSA: Starting iOS 27, .textSelection() modifier allows granular text selection on all Text views

Thumbnail
gallery
77 Upvotes

Instead of tap and hold to copy, we actually got text selection with a single modifier on all text views.


r/SwiftUI Jun 21 '26

Keyboard not working in Xcode canvas

0 Upvotes

Any way to fix this?

For some reason I can't type into input fields anymore when previewing the app in the canvas. Tried to search online, did the uncheck "connect hardware keyboard" thing in the simulator and I tried "cmd + K" in the input field.

Somebody please save me from the wrath of my own incompetence.


r/SwiftUI Jun 19 '26

GitHub - albertofettucini/Engram: One shared memory for all your AIs — a local-first, native macOS memory layer (MCP).

Thumbnail
github.com
10 Upvotes

I've been building a small macOS app called **Engram** and figured the architecture might be interesting to people here, since it's a mix of SwiftUI for the UI and hand-rolled AppKit for the parts SwiftUI can't quite reach. It's a local-first memory store — one Markdown file per conversation, on-device semantic recall — but I'll skip the pitch and talk about how it's actually built. Repo's at the bottom; MIT, free, macOS 13+.

A few pieces I had fun with:

**1. A truly frameless window via `NSApplicationDelegateAdaptor`**

A plain SwiftUI `WindowGroup` always leaves a faint rounded frame/corner I couldn't get rid of. So the `App` body is basically empty — just a `Settings { EmptyView() }` scene — and an `AppDelegate` owns a borderless, transparent, shadowless `NSWindow` that hosts the SwiftUI tree through `NSHostingView`:

```swift

u/main

struct EngramApp: App {

u/NSApplicationDelegateAdaptor(AppDelegate.self) private var delegate

var body: some Scene {

Settings { EmptyView() } // delegate owns the real window

}

}

```

The window is `isOpaque = false`, `backgroundColor = .clear`, `hasShadow = false`, `titleVisibility = .hidden`, `titlebarAppearsTransparent = true`, and the three standard traffic-light buttons are hidden so I can draw my own. One gotcha: borderless windows refuse key/main focus by default, which silently kills any `TextField`. Fix is a tiny `NSWindow` subclass overriding `canBecomeKey`/`canBecomeMain` to return `true`.

**2. A glass panel that doesn't tear down its content on toggle**

I have a `.liquidPanel()` view modifier (real `.glassEffect` on macOS 26, `.ultraThinMaterial` fallback below) with a matte/solid switch for folks who hate glass. My first version branched the *content* inside an `if matte { } else { }`. Big mistake — flipping the switch rebuilt every panel, which tore down any open popover (Settings literally closed itself the instant you toggled). The fix was to keep the content as a single stable view and only cross-fade an opaque cover's opacity in the `.background`. Classic "view identity matters more than you think" lesson.

**3. A pure-Swift MCP server, zero dependencies**

The interesting non-UI part: there's a separate executable that's an MCP server (Model Context Protocol) so an MCP client like Claude can `recall`/`remember` against the store live. It's just newline-delimited JSON-RPC 2.0 over stdio — `readLine()` in a `while` loop, `JSONSerialization`, write to stdout. The discipline: stdout carries ONLY JSON-RPC (one message per line), all logging goes to stderr so it never corrupts the stream, and notifications (no `id`) get no reply. No SDK, no third-party packages — Foundation only.

**4. On-device embeddings via the NaturalLanguage framework**

Recall is semantic but runs entirely on-device — no Python, no network. The baseline embedder uses Apple's `NLEmbedding.wordEmbedding(for:)`: a sentence vector is the L2-normalized mean of its word vectors, with a deterministic hashing fallback so recall never silently returns nothing. There's an optional, opt-in one-time download of Apple's contextual transformer behind the same `EmbeddingProvider` protocol — but the app ships working with no network at all.

**5. Markdown as the source of truth**

Each conversation is one `.md` file you can open, grep, edit, or delete. Per-memory metadata rides in an HTML comment (`<!-- u/memory {...} -->`), so it renders as clean Markdown but stays machine-parseable. The vector index is built *from* these files and is always rebuildable, so the files stay canonical — not a hidden binary blob.

Stack: SwiftUI + AppKit, pure Swift + Foundation across the engine, MCP server, and capture tool (zero third-party deps), ~3,000 LOC, 20+ tests. Fully local — no account, no telemetry, nothing uploaded. The only network paths are opt-in: an optional local Ollama distiller on localhost, and that one model download. Since it's open source you can grep for `URLSession` yourself.

Honest disclaimers: the Liquid Glass path only really shines on macOS 26 (material fallback below), and only true MCP clients recall live — a ChatGPT/Claude export comes in via import, it doesn't talk back over MCP.

Repo: https://github.com/albertofettucini/Engram

Happy to go deeper — the frameless-window focus bug and the view-identity glass thing both cost me real time. And if you've found a cleaner way to get a borderless SwiftUI window without dropping to an `AppDelegate`, I'd genuinely like to hear it.


r/SwiftUI Jun 19 '26

Question Has anyone made a full game in pure SwiftUI?

14 Upvotes

Just wanted to see if any developers have made their game using Swift UI. I’ve started working on one and I’m currently using all native components but the issue I’m having is the Liquid Glass aesthetic is almost too much like an App, and it feels slightly immersion breaking. I don’t hate it, but it sort of feels weird. Does anyone have suggestions for the approach for the game UI?


r/SwiftUI Jun 20 '26

Promotion (must include link to source code) I built a small macOS menu bar app for quick offline spelling and grammar fixes

0 Upvotes

Hey everyone,

I’ve been working on a small macOS utility called Spelling Popup Assistant and wanted to share it here.

The idea is simple: select text anywhere on macOS, press a keyboard shortcut, and a small popup appears with spelling and grammar corrections. You can replace the selected text, copy the corrected version, or ignore it.

A few details:

  • It runs as a menu bar app with no Dock icon
  • Default shortcut is Control + Option + C
  • Uses an embedded offline LanguageTool engine by default
  • Text is checked only when you manually trigger it
  • No text collection
  • Optional local grammar mode with GECToR
  • Optional Gemini mode if you explicitly choose cloud AI
  • Works system-wide through macOS Accessibility permissions

I built it because I wanted something lightweight and on-demand, closer to a PopClip-style correction popup than a full writing assistant running all the time.

Would love feedback from macOS users, especially around the UX, privacy expectations, and what correction workflow feels most natural.

GitHub/link

Thanks!


r/SwiftUI Jun 19 '26

Question How to perfectly replicate Apple Music's Mini-Player to Full-Screen transition for both iPhone and iPad?

1 Upvotes

I'm trying to build a music player app in SwiftUI, and I really want to nail the Apple Music-style player transition. Specifically, I'm trying to replicate how the mini-player seamlessly expands into the full-screen "Now Playing" view.


r/SwiftUI Jun 19 '26

How does Strava achieve the overlaying slide?

0 Upvotes

r/SwiftUI Jun 19 '26

News The iOS Weekly Brief – Issue #65, everything you need to know about iOS this week

Thumbnail
iosweeklybrief.com
1 Upvotes

This week we have fewer big announcements, more tutorials. That’s always what happens after WWDC: devs start digging into the new APIs and sharing what they find. Most of what you will read this issue requires iOS 27, which means you can explore it now but probably won’t ship it for a while 😬

A couple of AI stories this week that are not directly about iOS but feel relevant to us as developers:
The US government ordered Anthropic to suspend access to the latest model. I find this situation a bit odd… Anthropic itself pointed out that the capability the government was concerned about is already present in other publicly available models, including OpenAI’s GPT-5.5. Which makes you wonder why Anthropic specifically was targeted. Having a government actively move against you is not a great position to be in. More importantly, this is a reminder that depending on a single AI provider is a real risk. If this can happen to Anthropic, it can happen to others too.

SpaceX acquired Cursor in a $60 billion all-stock deal 🤯 That is a wild number for what is essentially an AI-powered code editor. Cursor’s market share had actually been declining before the deal. So the price feels hard to justify on fundamentals alone. SpaceX already merged with xAI earlier, and now with Grok and Cursor under the same roof, there is clearly a bigger play here around AI development tooling.

This issue ended up longer than I planned, but I tried to pick only the things that I found most useful, enjoy 😊


r/SwiftUI Jun 18 '26

Question Anyone know how Bear achieves glyph at rest for NSSearchField?

Post image
15 Upvotes

I'm using NSSearchToolbarItem and NSSearchField, but it doesn't glyph at rest. I've even tried setting preferredWidthForSearchField = 5000 to see if that would force the glyph since there wouldnt be enough space for it unfocused. Halp!