Hacker News new | ask | show | jobs
by weiming 2242 days ago
Now I'd like some native Rust bindings for Cocoa/UIKit, perhaps as an "official"/higher-level alternative to https://crates.io/crates/objc. There are some crates already attempting to replicate all of Apple frameworks, but they are community-supported/require a bit of `unsafe`.
2 comments

You won't get around the unsafe.

I've been hacking away at these for a few months now: https://github.com/ryanmcgrath/cacao

Goal is to get a good-enough version to build apps with. I'm dogfooding it for my next product so there's some incentive to keep pushing.

The state of Rust MacOS bindings is pretty bad. Last I checked, a lot of crates are built on top of the `core-foundation` crate which is full of unsound abstractions. And a lot of them seem to be hard to fix, as the Core Foundation types are all equivalent to `Arc<Data>` with no synchronization of the inner data. This makes mutable collections very complicated to model, for instance.