Demonstrates the ability to generate the necessary bindings for a rust lib compiled for an apple target to be embedded and called by a Swift project in Xcode.
- cargo
- xcode from Apple app store
rustylib rust library with two exposed functions
swiftyapp hello world ios app that imports and uses the two rust lib functions
swiftyrustlib Swift package of rust lib
- Run
make rust(or./build.sh). - Open the Xcode project located at
swiftyapp/swiftyapp.xcodeproj. - Ensure that RustyLib was successfully imported into project.
- Build and run the project in Xcode.
- For Intel Macs, enable and choose the Mac Catalyst destination in Xcode.
- On Apple Silicon Macs, you can also choose My Mac (Designed for iPad) in Xcode.
- Verify that the Rust library functions are successfully called from the Swift project.
make rustbuilds the Rust static libraries, Swift bindings, andRustyCore.xcframework.make resolverefreshes the local Swift package reference in Xcode.make appbuilds the app for a generic iOS Simulator destination.make catalystbuilds the app for Mac Catalyst.make cleanremoves Rust and Xcode derived build artifacts.
