A practical guide to bridging Rust code to Swift using uniffi-rs, covering the core API concepts: Record, Object, Enum, Option, Result, and custom types. The post walks through each primitive with Rust and Swift code examples, then demonstrates a real-world use case — exposing a zero-knowledge Sudoku proof system (Groth16 over BLS12-381) to iOS using cargo-swift. Includes setup, proof generation, and verification bridging, plus tips on version compatibility and deployment targets.
Table of contents
Primary APIRecord Containing an Objectuniffi::EnumReturning an enumOptionResultGet Jonikorjk’s stories in your inboxuniffi::custom_type!A real-world example: zero-knowledge SudokuBridging the circuit APIGenerate BindingsFinal ThoughtsReferences326 Impressions