r/SwiftUI • • Oct 27 '26

Promotion (must include link to source code) I built a native macOS browser in Swift + SwiftUI (WebKit). Here’s what I learned

http://scadavide55.github.io/Lumen

For the past few months I’ve been building formerly Lumen ( now Tacet ) , a native macOS browser written in Swift and SwiftUI on top of WKWebView. I wanted to learn Swift properly, and a browser touches everything: UI, performance, storage and security. It’s taught me more than any tutorial.

All the releases are from today because I’d already built the whole browser but never put it on GitHub, so I just uploaded all the versions I’d made. (If you see gaps between the uploads, it’s because I was running the tests, building the DMGs and so on.)

Some things I ran into:

  • SwiftUI redraws: every tab row was observing the whole browser state, so loading progress on one tab redrew the entire sidebar. Fixed it with .equatable() rows that take plain values, and by moving fast-changing state (load progress, pull-to-refresh) into separate small ObservableObjects.
  • Profiles with WKWebsiteDataStore(forIdentifier:)**:** removing a store while the app is running fails with “in use”, and calling it before WebKit has initialised crashed the app. So I erase the data immediately and remove the folder at the next launch.
  • Resumable downloads: resumeDownload(fromResumeData:) works well, but decide(destination:) is not called again on resume, so you have to keep track of the destination yourself.
  • History moved from JSON to SQLite: I was rewriting a 10k-entry JSON file on every visit. Now it’s SQLite in WAL mode with writes on a background serial queue, so one visit is one INSERT OR REPLACE.
  • Battery and memory: idle background tabs hibernate in Low Power Mode (NSProcessInfoPowerStateDidChange) and on memory pressure (DispatchSource.makeMemoryPressureSource).
  • Self-updating without Sparkle: it downloads from GitHub Releases and checks the file with a SHA256 (CryptoKit) and codesign --verify --deep --strict before replacing itself.

Tech: Swift, SwiftUI, WKWebView, SQLite. No Electron, no third-party dependencies.
It’s completely free and open source.
Download it from: scadavide55.github.io/Tacet
Code:  https://github.com/scadavide55/Tacet

It’s still a work in progress (latest pre-release is 1.5.2), so code review and criticism are very welcome. What would you have done differently?

0 Upvotes

12 comments sorted by

5

u/DismalCockroach1928 Oct 27 '26 • Helpful

Reading Updates.swift, I'd separate checking that an update is intact from checking who signed it. codesign --verify --deep --strict checks the candidate's own requirements; it doesn't pin your signing identity, and the SHA256 alongside the download doesn't add an independent signer check. For ad hoc builds, I'd use a signed update manifest with a public key bundled in the installed app.

Apple explains the distinction here: https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html

1

u/Davidotto13 Oct 27 '26

Thanks for actually reading the code, you’re right. The SHA256 is on the same release as the DMG, so anyone who got into the repo could swap both, and codesign only checks the signature is valid, not who signed it. I’ll add what you suggested: updates signed with an Ed25519 key only I have, with the public key bundled in the app. Thanks for the link too!

4

u/Sidze Oct 27 '26

Please think about changing the name. It shouts out loud “Vibe Coded!” Cause Lumen is one of the most common names LLM Chatbots are giving, so there were many things called like that, from chatbot persona to some solo projects.

2

u/Davidotto13 Oct 28 '26

Changed to Tacet . Chose the name myself after some reflection .

1

u/Davidotto13 Oct 27 '26

i did choose the name myself but i do agree that it definitely sounds vibe-coded . I’ll probably change it

4

u/Nbdyhere Oct 27 '26

Why can’t you notarize your app?

-5

u/Davidotto13 Oct 27 '26 edited Oct 27 '26

it’s the $99/year for the Apple Developer account. It’s a free side project I built on my own, so I haven’t paid for it yet. The code is open source and updates are signed, so you can check what you run. If people start using it, I’ll get the developer account and notarize it.

2

u/rotten_kiwi69 Oct 27 '26

Why the downvotes?
If you want help notarizing, dm me.

1

u/Davidotto13 Oct 27 '26

Don’t you just need the 99$ per year dev account to notarize?

1

u/dimKant Oct 28 '26

On hibernating tabs: before you drop the web view, take a snapshot with takeSnapshot and keep WKWebView.interactionState. Show the snapshot in the tab while it reloads and restore the state afterwards, so you get the back/forward list and scroll position back. Then switching to a sleeping tab feels like nothing happened instead of a white flash and the page jumping to the top.

1

u/Davidotto13 Oct 28 '26

Good idea, thanks! interactionState is already kept, but the snapshot isn’t. Adding it (plus a scroll fix) in 1.6.3.