Using UniFFI binding iOS App#
Cedarling UniFFI binding exposes its init, authz and log interfaces to different languages and on all the different platforms, including Swift for iOS. This section covers how to build and use Cedarling UniFFI binding in an iOS app.
Prerequisites#
- Rust: Install it from the official Rust website.
- Xcode: Available on the Mac App Store.
Building#
-
Clone the jans monorepo and change directory to
/path/of/jans/jans-cedarling/bindings/cedarling_uniffi.git clone https://github.com/JanssenProject/jans.git cd /path/of/jans/jans-cedarling/bindings/cedarling_uniffi -
Ask toolchain manager to install support for compiling Rust code for iOS devices and iOS Simulator
rustup target add aarch64-apple-darwin aarch64-apple-ios-sim aarch64-apple-ios
- Run below command to build and import binding into iOS project:
make ios
Use make ios BUILD_TYPE=release or make ios BUILD_TYPE=debug to build in release or debug mode. If BUILD_TYPE is not specified, the release profile is used by default.
-
Open
./bindings/cedarling_uniffi/iOSAppin Xcode. Import both the XCFramework./bindings/ios/Mobile.xcframeworkand the Swift file bindings./bindings/build/cedarling_uniffi.swiftfiles into your project (drag and drop should work). -
Run iOS project on simulator.
We have included a sample iOS app using Cedarling UniFFI binding for making authorisation decisions. Here is a demonstration video of its working.