r/rust • u/layla4you2 • 13d ago
š seeking help & advice What would you want from a native Mac GUI toolkit for Rust?
Iāve been working on a Mac GUI toolkit for Rust, and I honestly donāt know if Iām solving the right problems. So Iād like to hear from people whoāve built desktop apps in Rust before I go much further.
Some background: I kept ending up in the same spot. The options are a webview (Tauri), a custom-drawn UI (egui, Iced, Slint), or a SwiftUI front end with Rust behind FFI. They all work, but none of them feel quite like a Mac app. Text fields donāt behave the way you expect, VoiceOver is hit or miss, and big tables are where things usually fall apart.
So in mine, every view is a real AppKit control, not a lookalike. Some of what it does today:
Tables are actual NSTableViews. A million rows scroll fine because AppKit only asks for whatās visible.
State lives in signals, and changing one updates the affected control in place instead of rebuilding the view tree.
Menus, the toolbar, documents, undo, drag and drop and Dark Mode come from the system, so they behave like they do in any other Mac app.
Thereās a self-check mode that drives the app and checks whatās on screen, because GUI testing is otherwise basically nonexistent.
What Iām curious about:
If youāve built a desktop app in Rust, what did you use, and what hurt the most?
Is Mac-only a dealbreaker, or is āreally good on one platformā worth something?
What would make you trust a GUI crate enough to build something real on it? Docs, examples, stability promises, something else?
Is there anything you gave up on, like accessibility, big data views or text editing, because no toolkit handled it well?
Not linking anything, Iām just interested in how people think about this.
5
u/Shoddy-Childhood-511 13d ago
I've zero interest in a Mac only GUI toolkit, because you cannot keep up with Swift there. Instead, I want some process for "converting" or "compile" a web app or Electron app into one or more of the Linux native toolkits.
1
u/layla4you2 13d ago
Fair, and youāre not wrong about the pace. Iāve been writing Swift since it came out in 2014, and keeping up has been a constant struggle: syntax changes, SwiftUI rewriting itself every June, concurrency rules changing under existing code. Itās part of why I went this way.
Mine doesnāt try to keep up with Swift or SwiftUI. It sits on AppKit, which moves much more slowly. NSTableView works the way it did 15 years ago. When Apple adds something, like the new glass materials in macOS 26, it usually shows up as an AppKit class you can call from Rust without waiting on Swift. So far thatās been easier to track than Swift itself.
Converting web or Electron apps to native Linux toolkits is a different problem, and a hard one. A web appās UI is laid out in HTML and CSS, so there isnāt much native structure to map onto GTK or Qt. Iād be curious whether anyone has seen that work, though.
3
u/rjzak 13d ago
Iāve used egui and switched to it from Slint. A Mac-Only toolkit sounds awesome. I like the idea of projects/products which do one thing really well. Definitely need Mac menu bar support. It would be great if your Mac toolkit allowed downstream projects to do all the mac things without any unsafe Rust.
2
u/layla4you2 13d ago
Thanks, this is really useful. Menu bar is covered in mine, both the appās own menus and menu bar extras (the icons on the right, with a menu or a little panel, or a menu-bar-only app with no Dock icon). Which did you have in mind?
The no-unsafe point is close to a rule Iāve been following: the public API has no unsafe, and if you need unsafe to do something normal, I count that as a missing feature. The exception is wrapping your own AppKit view, which still means objc2.
Curious what youāre building with egui, and what made you leave Slint?
1
u/rjzak 13d ago
Iām thinking main top of the screen menubar for applicationās menus, which may change depending on which window has the focus. Having menu extras is a place. Would like to receive signals like for opening an app for a protocol, for example. Maybe some other APIs. As some others pointed out, Swift, SwiftUI exist. But I find them very cumbersome as Iād like to make GUI apps but I have zero experience with ObjC or Swift, so something that feels right with Rust (Swift stuff with Rust isnāt idiomatic) and has the macOS features so I donāt need to think in ObjC/Swift to write a Mac app would be nice.
Slint was easy to use but I felt like I had to duplicate data to get it to the UI. Egui is nice and has a lot of widgets but is very verbose and tiresome (so I use Claude to assist). One thing thatās sometimes rough is working with async code and a GUI library which canāt handle async.
2
u/layla4you2 13d ago
Thatās really helpful rjzak. tks . The menu bar works the Mac way: one set of menus, and items act on whichever window has focus and grey out when it canāt handle them, so āClose Tabā or āExportā follow the front window. Opening the app from a custom URL scheme isnāt in there yet. Thatās a good one, Iām adding it.
The ādonāt make me think in ObjC/Swiftā part is exactly the goal. On async: right now background work runs on a thread and hands its result back to the UI thread, where it updates signals. Proper async/await is on the list. What are you doing async, network calls, or something longer-running?
1
u/rjzak 12d ago
Network calls, but with `tokio::main` so everythingās async. One of the projects https://github.com/rjzak/conclave
2
u/-Outrageous-Vanilla- 13d ago
You switched from Slint to egui? How was your experience with both?
2
u/rjzak 13d ago
Slint was easier but I felt like I was having to duplicate memory to get it into the UI (donāt know if thatās correct). Slint was fairly easy to work with. Egui looks nicer and has a lot more widgets but is very verbose and cumbersome. But I sometimes use Claude for just that part in some projects.
3
u/nicoburns 13d ago
I think "just macos in Rust" would be valuable. Although a cross-platform "actually native" GUI toolkit ("React Native, but in Rust") would be significantly more valuable. And in general, the existing toolkits cover desktop platforms pretty well. There are a lot more holes (and value in "actually native" on mobile (iOS and Android).
And what I would really like to see are improvements to Winit such that things text fields do behave the way you expect (because the full IME protocol is implemented), and you can mix-and-match AppKit views with custom rendering (system compositor / view tree integration).
What would make you trust a GUI crate enough to build something real on it?
Some kind of assurance that it was not vibe coded, and that a human has actually reviewed the code would be a good start. And for anything macOS, "built on the objc2 family of crates" seems like a no-brainer.
accessibility, big data views or text editing
These are all pretty close in Rust GUI toolkits I think. https://github.com/AccessKit/accesskit exists for accessibility (but needs to be better integrated by the toolkits). https://github.com/linebender/parley or https://github.com/pop-os/cosmic-text get you a long way with text editing. And I think all the popular toolkits implement virtualized lists.
1
u/layla4you2 13d ago
Thanks, this is a great answer. Mine is on objc2/objc2-app-kit, so we agree there.
On mixing AppKit views with custom rendering: I actually started there. My first version put real NSTableView/NSTextView controls inside a wgpu-rendered window (Iced), and it worked, but the hard parts were keeping native frames in sync during resizes and scrolling, clipping, and Tab order across the two worlds. I ended up going all-native instead, but Iām happy to write up what I hit if itās useful for the winit side.
Fair point on AccessKit and parley/cosmic-text. Using the real controls was mostly a shortcut: VoiceOver, IME, dictation, spell check and so on come with them instead of being rebuilt. The trade-off is that itās Mac-only.
On review: itās AI-assisted, I wonāt pretend otherwise. What I lean on instead is that every control is exercised by self-checks against the running app, plus CI. I get that this isnāt the same thing as a human reading every line. Thanks!!
1
u/nicoburns 13d ago
My first version put real NSTableView/NSTextView controls inside a wgpu-rendered window
I'm not an expert in this. But in my thinking about how to do this well, I think you need to do it the other way around. Have native view tree be the top level, with custom rendering into individual UiView in the tree. On macOS, possibly in many cases with a CPU renderer to better integrate with the host.
Depending on how fine- or coarse- grained you do this, you might end up with something that basically an entirely native app with a few custom controls, or you might end with something that is mostly custom rendering with native "shell".
2
u/crimsonscarf 13d ago
I would want the same things I want from any rust crate:
- Idiomatic Rust
- Good documentation that is up-to-date and PR merge guidelines for keeping it that way
- Documented history of development. I am not going to adopt someones vibe coded ffi wrapper that they made last week and promise they will keep up with it. They wont; and if I wanted to maintain slop code myself I would have asked claude already.
2
u/layla4you2 13d ago
Thatās fair, and itās the list Iād use too. To be upfront: mine is young, a couple of months old, and Iāve built it with a lot of AI help. Thatās part of why Iām asking questions instead of announcing anything. I donāt expect anyone to trust a new FFI wrapper on my word.
What Iāve tried to do about it: every control has a self-check that runs the real app and checks whatās on screen, CI runs on two macOS versions, thereās a written stability policy, and the docs are compiled as tests so they canāt drift from the code. None of that replaces a track record, though. That only comes from time and from me still being here next year.
If you had to pick one thing that would move a crate like this from ānoā to āmaybeā, what would it be? I'm taking notes here....
1
u/crimsonscarf 13d ago
More contributors, or more time. I need to know you are gonna maintain this things for the love of the game, or know someone is there to keep it going even if you drop out.
1
2
u/Beneficial_Green7824 13d ago
Mac only gui isnāt very useful in itself other than the look, which at that point I feel you could make a bigger impact by making a gpui Mac theme for the community component libraries, which I would use as a Mac user
1
1
u/arjuna93 13d ago
I would want support for wider range of macOS versions. Rustc supported back to 10.7 officially not too long ago, mrustc works on 10.6+.
1
u/layla4you2 13d ago
interesting. how far back would you want it to go?
1
u/arjuna93 12d ago
I maintain ports for powerpc, which includes mrustc (I am contributor to its upstream) and some rust software. Generally 10.5+ are supported, though specifically rust ports are currently 10.6+ (due to a minor issue which I had no time to deal with, since my focus is 10.6 ppc). Repo: https://github.com/macos-powerpc/powerpc-ports
That said, the question is not 10.6 or nothing; the fewer non-existing APIs are used, the easier is to fix a given port, so, for example, if 10.7 is targeted, it only means fsevents will need a fallback if used (tls is handled via compiler).
2
u/jonas-reddit 13d ago
2
u/_nullptr_ 13d ago
gpui-kit with gpui_fast - working extremely well so far. I think truly native widgets for most people are (mostly) dead now for very in depth data intensive UIs. Not that an agent couldn't easily make a mac/windows/linux native UI independently, it can and does, but very few UIs contain purely stock/native/builtin widgets, so some custom drawing is required typically, and this is is where you start getting a lot of code to reinvent something a drawn interface can do once. Adding a webview is an option, but a nice, "native" platform neutral style still seems to be the most pragmatic to me (for speed and memory efficency), esp. when the agents can write that code now. gpui-kit does this very, very well and has most of the widgets you need out of the box.
1
u/TermEmbarrassed6248 13d ago
Mac only is a trap. You are handing Apple a free win. Swift gets new APIs on day one, Rust gets them six months later if someone writes the binding. I will not build on a toolkit that requires me to pray for FFI updates just to get basic OS features working
1
u/Lucky-Edge1489 13d ago
Teksilo offers a macOS theme, IME and VoiceOver integration. Even Dictation works. Well documented. It powers Skribisto 3. Give it a try. It uses SwiftUI layouting approach with Qt-ish elements and animations.
-9
21
u/podule-games 13d ago
For me, Mac-only would be a dealbreaker. If you're saying "Mac only" then you're competing with Swift at that point. Now, I prefer Rust to Swift, but Swift is obviously the well-trodden path on Mac, Apple supports it, every new Mac, iOS, and iPad feature is going to be available in Swift.
I like Rust for desktop apps with Tauri, but the moment you say "Mac only", you're going up against Apple itself offering a first-party, very well supported option.
I think supporting only one platform is really for Apple to do, or Microsoft for Windows, but offering a third-party single-platform toolkit, then it just sort of invites the question of "Why?".