To target iOS from Rust, you must install the iOS target toolchain and configure your build to use the correct architecture and deployment target.
- Install the iOS target for your Rust toolchain by running
rustup target add aarch64-apple-ios. - Create a
Cargo.tomlprofile for iOS that sets the target and linker flags, adding[profile.release]withlto = trueandopt-level = 's'if needed. - Build your library for iOS by running
cargo build --release --target aarch64-apple-ios. - Link the resulting
.aor.dylibfile into your Xcode project using theOther Linker Flagsbuild setting.