This is an excercise in using Rust in an iOS project to demonstrate the possibility of future cross-platform code sharing.
The project uses Viaduct to perform requests from Rust and sends the results to Swift as ProtoBuffer objects, as described in Crossing the Rust FFI frontier with Protocol Buffers.
The results are then displayed using SwiftUI.
It doesn't really work against the Twitter API, but simply against some Mock Service instead. You get the idea.
To build this thing you'll need…
- Swift
- the protoc compiler and the Swift code generator, as described here
- Rust (I'm using the 1.56.0 stable toolchain) and support for iOS relevant architectures (aarch64-apple-ios, aarch64-apple-ios-sim, x86_64-apple-ios)
After you've installed the required prerequisites, run make
in the root folder to build the Rust library and then you should be able to compile the Xcode project.