Proof of concept: iOS app written in pure Rust
The heavy lifting is done by objc-derive.
objc-derive is a proc macro crate to help:
objcobjects/methods to Rust
selectorin pure Rust
Recently I looked into how to use Rust to write iOS apps. Most articles describe the hybrid approach of using Rust via FFI, where you use Rust for the core logic and Swift/ObjC/Flutter for the UI. Using 2 languages + FFI can be clumsy and error prone, so I was looking for writing the whole app in Rust.
A few things I learned along the way:
- The closet thing I found is cacao, which has a very preliminary iOS support. Proved defintely we can write iOS apps with Rust only though.
- Based on
cacaocode, I created objc-derive to help with exposing UIKit to Rust. This repo is an example of interacting with UIKit via
- Although it works, UIKit in Rust is super verbose.
- iced runs, but kinda buggy with iOS. I saw some intermittent crashes in real devices. It looks like something
objc-deriveis an interesting combo. You can write the UI with
icedand interact with iOS with