r/swift

I built a sparse n-gram search index for on-device app memory in Swift (beats SQLite FTS5 and Core Spotlight on query latency in my benchmarks)
▲ 3 r/swift+1 crossposts

I built a sparse n-gram search index for on-device app memory in Swift (beats SQLite FTS5 and Core Spotlight on query latency in my benchmarks)

I've been working on local-first app memory (chat history, notes, local knowledge stores) and kept running into the same problem: full-text search on-device either means shipping a heavy server-style search stack, or accepting slow linear scans over stored records.

So I built RecallKit — a Swift package that builds a sparse substring inverted index over your app's local records, tuned specifically for iOS-sized memory payloads (not directory-scale corpora).

How it works, briefly:

  • Records get chunked into bounded, overlapping spans instead of indexed as one giant blob
  • Instead of indexing every substring (which is quadratic), it extracts a sparse family of substrings using a byte-pair weight table, and hashes them with XXH3 into an inverted index
  • Literal queries become posting-list intersections, with exact verification at the end so hash collisions can't cause false matches
  • Regex queries go through a planner that extracts mandatory literal structure to narrow candidates before falling back to full regex evaluation

It ships with an actor-based service (RecallKitIndexService) with batch upsert/delete, crash-safe rebuilds, background compaction via BGProcessingTask, app-group aware storage, and adapters for closure-based blobs, SQLite, Core Data, and SwiftData.

I included a benchmark app that runs RecallKit side-by-side against a naive scan, SQLite FTS5, Core Data substring fetches, and Core Spotlight. On a 1,000-record synthetic corpus, RecallKit's query latency beat all four — but its cold build cost is the highest of the bunch, since it's doing chunking + sparse extraction + posting-list construction in-process. So it's a build-time-for-query-time tradeoff, and it's most attractive for apps that repeatedly query the same local corpus (steady-state reuse, not one-shot searches).

Repo + full write-up on the algorithm and benchmark numbers: https://github.com/gregyoung14/RecallKit

Would love feedback, especially from anyone who's fought with FTS5 or Spotlight for in-app search before — curious if the tradeoffs here actually match real-world workloads.

u/gregyoung14 — 8 hours ago
▲ 33 r/swift+4 crossposts

I created a RecognitionService that handles system-wide voice input fully on-device (no Google, no network)

Most voice input on Android - SpeechRecognizer.createSpeechRecognizer(context) calls — gets routed to Google's network-backed recognizer. I wanted that path to run locally, so I wrote one.

The service hooks the framework's SpeechRecognizer API. Once it's set as the default, any app calling createSpeechRecognizer(context) (no ComponentName) ends up in our pipeline and gets back transcription that never left the device. Pipeline is Silero VAD + Parakeet TDT v3 (114 languages, ~890 MB INT8) on ONNX Runtime with NNAPI.

Honest caveat: Gboard, Samsung Keyboard, and Google Assistant ship their own recognizers and skip the system default. So the default-IME voice button on most phones won't go through this. What does: accessibility tools, custom dictation UIs, and anything calling the framework API directly.

Models download on first use (~1.2 GB) via a foreground WorkManager job so it survives backgrounding. After that, fully offline.

Setup + demo APK: github.com/soniqo/speech-android

audio.soniqo:speech:0.0.9 on Maven Central

Library:

Happy to answer questions about the binder lifecycle, the foreground worker setup, or why SpeechRecognizer is such a tarpit of edge cases.

u/ivan_digital — 19 hours ago
▲ 20 r/swift+2 crossposts

speech-core — open-source C++17 runtime for on-device VAD + streaming STT + diarization + TTS

C++17 runtime that composes several open speech models behind a small interface layer:

  • Silero VAD → StreamingVAD (4-state hysteresis: silence / pendingSpeech / speech / pendingSilence)
  • Parakeet TDT v3 (FastConformer encoder INT8 + decoder-joint FP32 RNN-T state; CTC fallback)
  • Nemotron Speech Streaming 0.6B (cache-aware FastConformer + RNN-T, true streaming)
  • Omnilingual ASR CTC-300M (Wav2Vec2 + CTC, SentencePiece decode)
  • Pyannote Segmentation 3.0 + WeSpeaker ResNet34-LM → constrained agglomerative clustering in pure C++ (no ML-runtime dep)
  • VoxCPM2 (2B AR LM + AudioVAE, 48 kHz, zero-shot voice cloning, 4-graph pipeline: text_prefill → token_step ×N → audio_decoder)
  • Kokoro 82M, DeepFilterNet3

Two interchangeable backends — ONNX Runtime and LiteRT (libLiteRt from Google's ai-edge-litert wheel) — both CPU today; CUDA / TensorRT EP just landed on the ONNX path (build-flag gated, env-resolved, runtime-probed, CPU fallback). Build the orchestration core alone (zero ML deps) or with either / both backends.

C++17, Apache 2.0, Linux + Windows + Android, stable C ABI for FFI.

https://github.com/soniqo/speech-core

u/ivan_digital — 18 hours ago
▲ 31 r/swift

I open-sourced 112 dot-matrix loading animations for SwiftUI — no images, no dependencies

Dot. Dot. Dooot. 🟦

We're building Mana (an AI-first creation studio for iOS) and wanted the chat's "thinking" indicator to feel alive instead of a stock spinner. We found zzzzshawn's "matrix" (a React/CSS dot-matrix loader collection), loved it, and ported the whole thing to SwiftUI — 112 loaders across square / circular / hex / triangle / 3×3, plus some "fun" silhouettes (heart, arrow, snake) and an icon.

How it works:

  • Zero image assets, zero dependencies. Every loader is animated Circles driven by a single TimelineView.
  • Each loader is a per-cell opacity resolver ported ~1:1 from the upstream CSS keyframes + JS math (spiral snakes, ring waves, a literal heartbeat curve).
  • Deterministic: the same key always maps to the same loader, so they don't reshuffle as SwiftUI rebuilds on scroll. Reduce Motion aware too.

Two ways to use it:

DotmSquare3(size: 28)           // named component, 1:1 with the upstream API
MatrixLoader(.hex(3), size: 28) // by shape id, when the choice is data-driven

There's an interactive gallery + a runnable Swift Playgrounds example in the repo.

It's a derivative port, published with the original author's explicit permission (attribution + link-back throughout). Only the "fun" family is ours. iOS 18+.

Repo: https://github.com/mana-am/matrix-swift

Which one's your favorite? I keep flip-flopping between the hex ripple and the heartbeat.

u/Codenter — 2 days ago
▲ 10 r/swift

SwiftData and Database Manager Layer

Hello all,

I’m trying to better understand the different techniques people use to manage a SwiftData layer in a scalable application.

I understand that ModelContext is used to create, update, and delete SwiftData models, but I’m struggling to see how this approach scales cleanly beyond smaller applications. Passing a ModelContext from a SwiftUI View into a view model feels awkward. Also, the Query property wrapper is tightly coupled to the SwiftUI view layer.

I have a lot of questions about the intended architecture here. The overall approach feels very “Apple,” but I’m having trouble understanding why it is considered scalable as an application grows. In my own project, I’m ending up with far too much persistence logic inside my SwiftUI Views, and the code is becoming increasingly difficult to manage.

I’d love to have an open discussion about how others structure and manage their SwiftData layer in larger applications. I’m especially interested in approaches that keep SwiftUI views focused on presentation while still working naturally with SwiftData.

Hopefully, this can lead to a useful discussion that helps all of us write cleaner, more maintainable code.

Best,
S

reddit.com
u/Moo202 — 2 days ago
▲ 5 r/swift

How can I completely remove Xcode and reinstall it from scratch?

My Xcode installation is a complete mess right now because of old work accounts, projects, teams, and other leftover data. I want to start fresh. How can I remove everything including all accounts, Apple IDs, developer teams, certificates, provisioning profiles, and related dataand then reinstall Xcode as if it were a brand-new installation?

reddit.com
u/Immediate_Amoeba_532 — 3 days ago
▲ 5 r/swift+2 crossposts

Claude Code Dynamic Island on macOS

It runs automatically once you start a claude code session and gives you a trigger whenever claude needs permission to do something. Also if you hover over it you get some info about whats happening in the current session like the current filename getting edited and so on.

Fully free and open source

u/Impossible_Step6452 — 3 days ago
▲ 12 r/swift

What’s everyone working on this month? (July 2026)

What Swift-related projects are you currently working on?

reddit.com
u/Swiftapple — 4 days ago
▲ 0 r/swift

Plugin for Swift (swift-tothemax)

Got tired of how terrible Claude is for iOS dev so first thing I made with Fable was a plugin that covers not only Swift code but HIG conventions, App Review stuff, legal/privacy requirements, and the release process. Also a UI crawler that walks your app and flags crashes/console errors.

The skills are all intended to work together and has an orchestrator skill that gets it to do what it's supposed to. Did a quick test with Fable and it was able to pretty much one shot an app with no issues but yet to test that with Opus.

[https://github.com/Dev869/swift-tothemax\](https://github.com/Dev869/swift-tothemax)

reddit.com
u/Due_Leadership_7883 — 4 days ago
▲ 20 r/swift

Swift's mentorship program is loaded. But where there's will there's a way

Hey all! As someone who primarily works with Python I was highly looking forward to participating in the Swift mentorship program to level up but recently heard that they don't have the capacity. So I'm putting together a discord server where we can level up together. We'll separate roles as mentors and mentees and maintain the same meeting goals as the actual Swift mentorship program. There'll be more details in the server. If you're interested in being a mentor at a minimum you'll have to show that you have made contributions to the language or possess significant knowledge in a specific area. Please DM for invites and which role you're looking to join as (mentor or mentee).

(I hope this isn't considered as self promotion as I'm hoping to benefit fellow Swifters)

u/RSPJD — 5 days ago
▲ 0 r/swift

is flutter faster than swift native for IOS gui app development?

according to benchmarks done in this link it seems flutter actually beats swift in some areas?

but isnt native code supposed to run faster than flutter?

reddit.com
u/alipolo7777 — 4 days ago
▲ 1 r/swift

Load view on top of another view (multiple pages within one "section")

It's been a while since I last worked with Xcode/Swift.

What I've got: A storyboard/UIKit layout with a single view controller with a single view (v1) with a single button (b1).

What I want to do: Once b1 is pressed, it opens another view (v2) with another button (b2) on top of v1 (on top = completely covers v1 and b1 isn't pressable anymore). Once b2 is pressed, v3 with a text input field and b3 is opened. Once b3 is pressed, the string in the input field is passed back to v1 and v1.allDone() is called.

I know how to do the whole button pressing thing and I remember that you can pass data back and forth between two view controllers using a segue but I remember that that is usually only used for bigger "sections": E.g. a login page would be one section, and the main menu and the settings menu would be two more but multiple pages within the settings would be part of the same "section".

What is the current way of creating multiple pages within one of these sections (no "back" button and I don't want to be able to swipe left or right to go to the next/previous page!) and switching/passing data between them with storyboard/UIKit?

reddit.com
u/ZiaQwin — 4 days ago
▲ 6 r/swift

Does anyone know what’s going on (or what happened) to the Cupertino MCP (it served Apple's official developer documentation to AI tools like Claude)? However, the GitHub repo and website are both down... It seemed to be a popular project, so I’m hoping someone here may know what happened.

Cupertino is/was a tool that crawled, indexed, and served Apple's developer documentation to AI agents via MCP, allowing you to supplement Claude (and other AI tools) with the official dev docs. However, the GitHub repo and website are both down, so I was hoping someone on this subreddit (perhaps even the developer) had some info about what’s going on.

github.com
u/MiddleAgedBanana — 6 days ago
▲ 342 r/swift

Building a macOS native GUI for Apple Container

i don't know if this is of interest to anyone, as i'm really just building it for myself, but i figured i'd open it up for anyone who wants to use it or contribute.

hopefully i don't get downvoted into oblivion for using ai, but if i'm being totally honest, i'm lazy. i have zero intention of making money from this. it's just a fun side project that fills a gap in my own homelab and lets me move away from docker since everything i run is on a mac anyway.

i've mainly been focused on the ui/ux. it's pretty minimal at the moment because i wanted to get all the features working first, but i'd say it's basically feature complete. my focus now is hunting down edge cases and bugs, then manually going through every view to add specific visual polish and little quality of life improvements that make everything feel finished.

if you do decide to use it, just keep in mind it's probably going to have issues. ai isn't perfect, and neither am i. if you run into bugs, weird behaviour, or have ideas for improvements, feel free to open an issue or contribute.

github: https://github.com/tdeverx/contained-app

download: https://github.com/tdeverx/contained-app/releases/tag/nightly-latest

u/tdevx — 9 days ago
▲ 0 r/swift

Steven, your new mood companion

This is Steven the elephant, your new mood companion. When you're happy, he's happy. When you're sad, he's sad.

I felt like a lot of mood trackers are very sterile and "too" clean. Sometimes it makes you feel bad for having a bad day. I wanted to create something where you spend one minute a day logging your mood, low stakes but still meaningful in a playful way.

It's totally free, no tracking, no ads, no subscriptions.

What's next?

Currently working on adding an angry mood.
Chat mode to ask follow up questions on the mood analysis.

Further ahead:

More moods
Achievements/Badges
Widgets
More languages
Better animations

Feel free to give it a try
https://apps.apple.com/us/app/steven-mood-tracker/id6775122773

u/barcode972 — 7 days ago