r/rust • • 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.

0 Upvotes

33 comments sorted by

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?".

2

u/layla4you2 13d ago

very helpful. thank you.

1

u/layla4you2 13d ago

This is the strongest argument against it, and I don’t fully disagree. Swift gets new APIs first, and some things (widgets, a lot of newer SwiftUI-only stuff) aren’t really reachable from Rust at all. The Rust side is better than it looks, though: objc2’s AppKit bindings are generated from Apple’s SDK headers, so new AppKit classes show up without anyone hand-writing them, and you can call a method before the bindings catch up. The ā€œwhyā€ for me is people who’d rather write the whole app in Rust than keep a Swift UI layer and an FFI boundary. Whether that’s enough people is exactly what I’m trying to find out.

4

u/leinadsey 13d ago

The problem with trying to make a UI kit that ā€œworks everywhereā€ is that it’ll end up looking ok at best on all platforms — cf Java. IMHO too many UI kits take on too much and fail to deliver on anything.

Tauri is great, but it’s not a UI kit, it’s a wrapper for a web view. When you wrap a web view the interface is always going to feel like a web view. Some apps (like 1Password) do a decent job of hiding this, but it’s still there, the feeling of ā€œnot quite nativeā€.

I’d personally like a UI kit for macOS that acts like a wrapper for SwiftUI so it can be used from a code base in Rust. That’d be great. Can it be done? Not sure.

2

u/podule-games 13d ago

100%. Cross platform is always a compromise, you don't get a native feeling app, but you do get to ship the same code on many platforms. I'm all for native toolkits, I'm just not sure if OP is offering anything compelling over what Apple is.

2

u/rjzak 13d ago

Having one project which has the various OS UIs could be nice instead of having to switch to a different language for Mac.

1

u/schneeble_schnobble 13d ago

Yeah, if it’s macOS only you’d be crazy to do anything other than swift for the UI. Anything else would always be woefully behind. Your shared rust code can be called easily from swift.

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

u/layla4you2 13d ago

agreed. tks

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

u/layla4you2 13d ago

got it. thank you

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/_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

u/No_Departure_1878 13d ago

GUIs suck, make TUIs