#!/bin/bash set -e echo "Building iOS framework with UniFFI..." # Add iOS targets rustup target add aarch64-apple-ios rustup target add aarch64-apple-ios-sim rustup target add x86_64-apple-ios # Build for iOS targets cargo build --release --target aarch64-apple-ios --features uniffi cargo build --release --target aarch64-apple-ios-sim --features uniffi cargo build --release --target x86_64-apple-ios --features uniffi # Create universal library mkdir -p target/universal lipo -create \ target/aarch64-apple-ios/release/libchurch_core.a \ target/aarch64-apple-ios-sim/release/libchurch_core.a \ target/x86_64-apple-ios/release/libchurch_core.a \ -output target/universal/libchurch_core.a # Generate Swift bindings using cargo (this should work!) cargo run --features uniffi --bin uniffi-bindgen generate --language swift --out-dir target/universal src/church_core.udl # Copy to iOS project cp target/universal/church_core.swift ../RTSDA-iOS/RTSDA/ cp target/universal/church_coreFFI.h ../RTSDA-iOS/RTSDA/ cp target/universal/libchurch_core.a ../RTSDA-iOS/RTSDA/ echo "Done! Generated files copied to iOS project."