Live data from Hacker News

macOS Apps in Rust

github.com

61–70 of 89 posts

Re: macOS Apps in Rust

#61

If you use the Cocoa API with ObjC or Swift, you get Automatic Reference Counting (ARC), generated by the compiler. I guess with this you'd have to retain / release your objects manually again?

Author here.

Nope, retain on create/etc and release on drop happens automatically.

Re: macOS Apps in Rust

#64
post #46
post #42

Earlier quoted context omitted.

In most cases, these things would work, but not here. Tried everything, nothing works except using a pre-modules-compiler. In general, golang seems to work best with golang-only projects. As soon as there are other languages in the mix, like C++ here, things get very ugly very fast.

Ah, I think I misinterpreted what you meant by "nothing works anymore". I thought you were saying that no old Go projects were usable with new Go compilers. I believe you that this particular project may not work with the current toolchain.

Ah, yes, that wasn't sufficiently clear in my text. In almost all projects I've done/used, go modules work fine and are nice. It is just this one library that I know ceased to work.

Re: macOS Apps in Rust

#65
post #57
post #30

Earlier quoted context omitted.

afaik not a problem with apps written in something like react native which use platform specific widgets and common business logic.

It actually is. Fortunately, the quality of apps dropped significantly, allowing these technologies to compete.

why should it? it makes no sense to me; you can do anything

It just might be that you don't go all the way, because you think a 80% sufficient result is enough for you

Re: macOS Apps in Rust

#66
This is off topic, but thinking about portable desktop apps, why didn’t JavaFx become more popular? What is JetBrains using for its sophisticated GUIs? Is it just Swing? It would be great if Rust could be used to write portable high quality desktop apps.

Re: macOS Apps in Rust

#67
post #30

Earlier quoted context omitted.

> Can you give an example of something can only be done in a native app? Accessibility, text field behaviors, control animations looking right, window resizing behaviors, any system settings related to UI applying properly, printing, export to PDF, rich text copy and paste, normal power and memory use, the engineers working on the next OS release being able to fix your app if they break it, your app updating to the n…

afaik not a problem with apps written in something like react native which use platform specific widgets and common business logic.

There's more to a UI layer than individual controls. Like spacing between them fitting platform conventions, and window resizing and text size needs them to coordinate.

Re: macOS Apps in Rust

#68
post #14

Pretty cool project, seems like it's becoming more realistic to write cross platform native desktop applications with OS-specific GUIs in Rust. It's not too far from the write-once-run-everywhere philosophy of React native, Electron and similar. One could write their UI state and application logic once while maintaining 3 entry points using the various platform GUI bindings (gtk-rs, cacao, win32?) to represent the UI…

> Something that isn't talked about much in the GUI world (outside of mobile development) is how essential multi-threading is to a great application experience. Yes it is. Heavyweight desktop GUI applications like DAWs or CAD or image/video editing are old established technology. > This has the advantage of a project feeling natural to the platform while still allowing for code reuse between platforms Having written…

I do have a naive view on native GUI development because I have little real experience in it - I very much appreciate your insight.

> “Abstracting” away the native GUI/UX seems to be a common pitfall for junior devs

I would like to know more about what you mean here; my description of a "virtual UI" that you bind to from the native toolkit is an abstraction to the UI - but it's not an abstraction like Flutter which tries to merge all native widgets into abstracted widgets. My concept still requires you to write multiple native entry points using the UI kits of the target platforms.

` (GTK entry || Cacao entry || Win entry) => Virtual UI => application logic `

The idea is that the virtual UI would be an in-memory representation of the UI (have virtual buttons, labels, etc). It would be the job of the entry to correctly represent/bind to that virtual UI with the relevant presentation tool kit. The output binary would be specialised to the platform/UI kit used in the source entry point.

It seems sensible on the surface to decouple the UI from the native presentation as it minimizes the requirements of the native side to constructing the UI and binding to the virtual UI - but I would love to hear your thoughts.

I have not tested this architecture outside of web development but I imagine adding new UI targets (like web assembly, QT, etc) would be easier as it wouldn't require any changes to the virtual UI or application logic and would be a matter of creating a new entry point representing the UI for the new target.

> then they learn why Qt exists

Does QT feel native on MacOS, Windows and Gnome?

> Yes it is [talked about]

Could be my personal echo chambers talking here - but multithreading is almost never spoken about and/or often intentionally disregarded in modern web/electron applications.

It sucks because so many applications are written using Electron or other similar web wrappers.

> there isn’t a particular reason this hasn’t been doable in C/C++ since forever - Rust isn’t some silver bullet

Not dismissing this, I was more impressed that Rust offers a thread safety guarantee through its ownership model making it interesting from a contributor scalability standpoint.

I was thinking that it might make it easier to have more engineers working on a high performance GUI project because it would be significantly harder to break.

As an example; I could imagine if a company assigned a team of TypeScript/JavaScript developers with different experience levels onto a GUI project written in something like Go, there would be a lot of thread safety issues and seniors would spend a lot of time combing PRs for thread safety issues.

Rust, while perhaps not as simple from a syntax/types/symbols standpoint, offers an interesting development modality for these sorts of projects. I would expect that it would result in a more hands off contributor experience.

> Electron is about as far removed from the philosophy of targeting platform native toolkits as one can get.

Sorry I wasn't describing Electron as targeting platform native decorations - just that it promises an OS agnostic UI framework (write once run anywhere) at the expense of a diminished native experience and poor performance.

My point was that it might be interesting to explore the idea that a multi-entry native toolkit application fulfils the same "write once run 'anywhere'" promise but without the downsides.

Re: macOS Apps in Rust

#70
post #20

Earlier quoted context omitted.

You can't write good UI apps with cross platform code. The basic idioms of each platform are different. You can write your core application logic once and share it, but you need to have the interaction with the actual UI/window manager be per-platform. The reason electron apps are so bad on Mac is not that the core application logic is bad, it's that a whole bunch of basic Mac platform behaviors are broken. "modern"…

Yet among the most used apps a lot of them are cross platforms: chrome, ableton live, vscode, figma, any game under the sun, slack, discord, … I would even argue that very few still develop directly with native ui toolkits directly.

You mean the slew of electron apps that are well known to be annoying to use and inconsistent with the rest of the software on a Mac? Games not so much because they aren't using any platform toolkit.

But also "developers using cross platform toolkits because it's cheaper" does not undermine my argument "you can't make good apps", I could make the exact same argument about cross platform Java apps.

Post reply on HN