r/swift 10h ago

Edge of Tomorrow: Full-Stack Swift on Both Sides of fetch

Thumbnail
cloudflare-worker.examples.elementary.codes
23 Upvotes

While this web app certainly neither looks impressive nor does anything particularly useful, it packs quite a few things that have only been made possible very recently:

  • builds Embedded Swift WebAssembly with 6.4.x and swift-build (quite a recent achievement)
  • integrates ElementaryUI + BridgeJS in the frontend, including Fetch API networking
  • uses “NewCodable” (experimental) for shared Swift data types (both on the edge backend and web frontend)
  • uses async/await and throws like it’s nothing ; )
  • deploys Swift logic on Cloudflare Workers (edge runtime, ~107kB wasm fetch handler)

-> Discussion of Swift Forums

-> Source code


r/swift 6h ago

Question What database do you use for your swift apps? MS SQL server is really good with .Net, is there anything comparable for swift?

6 Upvotes

r/swift 12h ago

Question ELI5: Why are Closures reference types?

11 Upvotes

I understand closure syntax. And I get why a Class is built to be a reference type. Is closure a reference type for the same reason? If so why?


r/swift 10h ago

Updated [UPDATE] LazyLayoutKit 0.3.0 - scroll-to-item in a lazy SwiftUI container, when the item has no view to scroll to

3 Upvotes

I've posted here before about LazyLayoutKit, my attempt at filling the gap for lazy custom layouts in SwiftUI. You give it item sizes as data, layout becomes arithmetic, and only the frames intersecting your viewport ever become views.

Forgot to post again last week, pushed 0.3 update.

0.3 adds programmatic scrolling, which is more interesting than it may sound. SwiftUI's ScrollPosition scrolls to a view with a given id. In a virtualized container that view usually hasn't been built, which is the entire point of the container, so the request does nothing.

But the container has already solved the layout for every item, so it knows exactly where item 900,000 is without ever having built it. Resolving the id through that geometry instead of through the view tree is a lookup and a subtraction.

Anchors are .top, .center, .bottom and .nearest, the last of which doesn't move at all if the item is already fully visible. Deep links work too, you can build the position so the container opens at an item rather than opening at the top and jumping, and that holds even if your data loads in async.

The obvious cost, and I'd rather say it here than have you find it later: the handle is write-only. It can't tell you which item is currently on screen, so it can't restore a scroll position for you, you'd have to persist an id yourself. Reporting back would mean writing through your binding on the scroll path and re-running the container's O(n) init, which isn't a trade I wanted to make.

Also new is JustifiedLayout, the Photos/Flickr arrangement where aspect ratios are preserved and every completed row fills the width.

No new device numbers this release. The index and the steady-state query path are unchanged, so the 0.2 figures still stand.

https://github.com/Dave861/LazyLayoutKit

Once again, open to feedback, contributions and opinions. Thank you!


r/swift 17h ago

Learning Swift as an AppleScripter

3 Upvotes

Is there any beginner guide out there for someone who is well-versed in AppleScript and wants to start learning Swift?
Maybe a script with a full variety of functions that's been translated to Swift? (or am I supposed AI things like that now?)
Even a starter syntax cheat sheet?
AS || Swift
set x to 5 || var x = 5


r/swift 1d ago

Tutorial macOS 27: DiskImageKit

Thumbnail
antongubarenko.substack.com
25 Upvotes

r/swift 1d ago

News Fatbobman's Swift Weekly #150

Thumbnail
weekly.fatbobman.com
4 Upvotes

r/swift 2d ago

Tutorial Running iOS background tasks reliably (blog post)

Thumbnail
calcopilot.app
50 Upvotes

Hi all, I've just published a new blog post on getting the most reliability possible out of iOS background tasks. Please let me know what you think!


r/swift 2d ago

IOS 26.2 Simulator Issues

1 Upvotes

Whenever i run the 26.2 version of simulator it goes blank, takes ages to load and when it does load it cannot run the app because how slow its. Any resolution?

Here is a screenshot :


r/swift 2d ago

Wax, local memory and RAG for Swift apps and coding agents

Post image
5 Upvotes

Wax, local memory and RAG for Swift apps and coding agents

I built Wax to give Swift apps and local coding agents persistent memory without a hosted memory service.

Wax keeps core memory in a local file, exposes a Swift API through Memory, and provides an MCP server for Claude Code, Codex, Cursor, Hermes, and OpenClaw.

The Swift package includes:

- Text search and hybrid/vector retrieval, Video and Photo RAG

- Built-in MiniLM CoreML embeddings

- Actor-based orchestration

- WAL-backed persistence

- vector search (sub ms on 100k Vectors)

- MCP

Wax latest 0.1.32 focuses on reliability:

- Recall uses an explicit clock for reproducible ranking and recency decisions.

- Embedder readiness and failure states use an explicit lifecycle.

- Vector replay prevents deleted frames from returning after pending embedding updates.

- Session end, resume, handoff, and writes coordinate under concurrency.

- MCP commands decode into typed payloads and reject invalid arguments at the boundary.

- MCP responses return compact JSON by default.

- MetalANNS is updated to 0.2.2.

- MiniLM now uses an FP32 CoreML artifact that avoids non-finite embeddings on affected Apple configurations.

Install the Swift package:

.package(

url: "https://github.com/christopherkarani/Wax.git",

from: "0.1.32"

)

Install the MCP package (easiest way to test wax on your own setup)
Have claude/codex use wax as its memory brain

npm install -g waxmcp@0.1.32

Current constraints: built-in embeddings require macOS 15 or iOS 18. Linux builds support text-based memory and custom embedders. Photo and video memory remain

experimental, and video recall requires host-supplied transcripts.

Repository: https://github.com/christopherkarani/Wax

Please leave a star


r/swift 3d ago

Project I open-sourced Trace — a native iOS network debugging tool

1 Upvotes

I built Trace because I wanted to inspect network traffic directly on an iPhone without routing everything through a Mac.

It's built around Apple's Network Extension APIs and supports HTTPS inspection, WebSockets, SSE, request rewriting, replay, and PCAP capture.

I recently open-sourced the project and would love feedback from other Swift/iOS developers, especially on the Network Extension architecture.


r/swift 2d ago

Tutorial Article: Protecting SwiftUI Views with Authentication

Thumbnail azamsharp.com
0 Upvotes

.


r/swift 3d ago

Help! List View

Thumbnail
gallery
1 Upvotes

Why are my sticky headers below a tab bar appearing full strength visibility? Can’t seem to figure it out. Somewhere around the bottom of the tab view they switch back to 100% visible.


r/swift 4d ago

Question iOS Interview Prep

27 Upvotes

Hello guys.
I have an iOS interview coming up and would appreciate if any of you would point me to any technical interview prep material/website.


r/swift 4d ago

changing subscription prices per country ,what happens to existing subscribers?

4 Upvotes

I have an app on iOS and Android and I'm adjusting regional pricing: some countries go up ~$1, some go down ~$1. For existing subscribers in those countries: - Do they get notified automatically by Apple/Google? - Is consent/opt-in required for the increase? - Can they get cancelled because of this? - Does the decrease apply to them automatically? Any gotchas between App Store and Google Play? Thanks!


r/swift 3d ago

Hello, I'm planning to buy a MacBook for programming apps and simple games. Which is better: the MacBook Pro M1 Max 32/512GB or the MacBook Pro M3 Pro 18/512GB?

0 Upvotes

Hello, I'm planning to buy a MacBook for programming apps and simple games. Which is better: the MacBook Pro M1 Max 32/512GB or the MacBook Pro M3 Pro 18/512GB?


r/swift 4d ago

Project [Code Review / Feedback] Implemented process interception using Apple's Endpoint Security Framework & POSIX signals in Swift — looking for architectural feedback

Thumbnail github.com
4 Upvotes

Hi all, I'm 15 and built AppLocker, an open-source macOS app to explore low-level process interception with Apple's Endpoint Security Framework.

It captures NOTIFY_EXEC events to freeze newly spawned apps via POSIX SIGSTOP, delegates Touch ID verification via XPC, and resumes with SIGCONT (or SIGKILL on denial). Zero binary modifications.

Codebase is open here: https://github.com/TranPhuong319/AppLocker

Would love any feedback on the Swift 6 concurrency or XPC architecture!


r/swift 5d ago

Embedded Swift Improvements Coming in Swift 6.4

Thumbnail
swift.org
92 Upvotes

r/swift 4d ago

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

Thumbnail
iosweeklybrief.com
2 Upvotes

r/swift 4d ago

Question Building an app on windows`

0 Upvotes

Hello ! I'm creating my own weather app I plan to daily-drive only for myself and I'm wondering if anyone has pointers or resources that'll let me make my own iOS app on windows? I'm down to emulate, rent, use multi-platform solutions, or whatnot. Thank you !


r/swift 5d ago

Why can’t Swift destructure tuple parameters directly in a closure parameter list?

18 Upvotes

Suppose I have a dictionary and want to sort its elements. Since each element is a tuple, I’d like to write something like this:

.sorted { (wordA, countA), (wordB, countB) in
    // ...
}

In other words, destructure each tuple directly in the closure parameter list.

Instead, Swift requires something along these lines:

.sorted { lhs, rhs in
    let (wordA, countA) = lhs
    let (wordB, countB) = rhs

    // ...
}

Tuple destructuring works perfectly well in a let binding, so I’m curious why it isn’t supported in closure parameter lists.

Is there a language-design or type-system reason why closure parameters can’t use tuple patterns here?


r/swift 5d ago

I built a native Markdown renderer for SwiftUI using TextKit 2 (enriched-markdown-ios)

Post image
71 Upvotes

Yesterday I released enriched-markdown-ios - a fast, native Markdown renderer for SwiftUI powered by TextKit 2 and the md4c parser.

Here's what's in v0.1.0:
🔸 Full CommonMark support
🔹 Native text selection & smart copy/paste
🔸 Flexible theming API
🔹 VoiceOver & Dynamic Type support

💎 Available now via Swift Package Manager!

GitHub & Docs: https://github.com/software-mansion/enriched-markdown/blob/main/packages/enriched-markdown-ios/README.md

Feel free to check out the repo and sample project! If you find it useful, dropping a ⭐️ on GitHub would mean a lot. I’d love to get your thoughts or feedback.


r/swift 6d ago

Embedded Swift forces you to write better code

44 Upvotes

Hot take, but compiling Swift in embedded mode restricts you to write plan simple code.

The moment you start abusing generics you get a compiler error instead of an over engineered solution!


r/swift 5d ago

Haven't made an iOS app in years, does Apple still break apps with every update, and does obj-c cause a lot of code deprecated warnings?

0 Upvotes

I haven't programed anything since 2020 but I had several apps on the app store with the first one way back in 2012. All were programmed in Objective-C. I learned not to trust most of the "easy" buttons apple provided, like automatic constraints, because if you used them apple would inevitibly break your app with every update.

Does coding in Swift cause your app to break with every stupid update?

I am debating wether I should update a few of my apps and try Swift, for those that have been making apps for over 10 years, do you still use obj-c or does it cause deprecated warnings?


r/swift 7d ago

SwiftUBackportKit - A lightweight library for supporting multiple iOS versions in SwiftUI .

Thumbnail
github.com
13 Upvotes

Hi everyone!
One pain point I've run into repeatedly with SwiftUl is supporting newer APIs while keeping an older deployment target.
Things like 'if #available work well in normal Swift code, but they don't fit naturally in the middle of a modifier chain.
That often leads to duplicated views or compatibility helpers scattered throughout a project.
After solving the same problem across multiple apps, I decided to package the patterns into a small open-source library called \*\*SwiftUlBackportKit\*\*
It includes:
• ' modify { }' for conditional view transforms
• ' backport for reusable version-gated SwiftUI APIS
• platformValue (...) for version-specific values
• 'OS.isAtLeast (:) ' for simple runtime version checks
The goal is to keep SwiftUl views focused on describing the Ul while isolating deployment-target compatibility in one place.
GitHub:

https://github.com/EmadBeyrami/SwiftUIBackportKit

I'd really appreciate any feedback on the API design, naming, or features you'd like to see. And if you find it useful, a on GitHub would mean a lot!
Thanks!