feat(bindings): Added UniFFI bindings to generate swift & kotlin code - #255
Open
ActuallyTaylor wants to merge 3 commits into
Open
feat(bindings): Added UniFFI bindings to generate swift & kotlin code#255ActuallyTaylor wants to merge 3 commits into
ActuallyTaylor wants to merge 3 commits into
Conversation
Author
|
A question for the maintainers, what is the release process of this repository? Would it make sense for their to be a local script that updates the |
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Shadow auto-approve: would not auto-approve because issues were found.
Fix all with cubic | Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds (UniFFI)[https://github.com/mozilla/uniffi-rs] bindings for generating Swift & Kotlin bindings. This is particularly useful for using the library in an iOS or macOS app.
UniFFI builds are gated behind the
uniffifeature. Swift bindings can be generated using these commands:cargo run --release --features uniffi --bin uniffi-bindgen -- generate \ --library "target/release/libpdf_inspector.dylib" \ --language swift \ --out-dir swiftNotes
This PR was written with Swift compatibility in mind. Because of this, there are no release workflows like other bindings. Swift Package Manager does not have a central repository, and rather relies directly on GitHub repositories. Properly packaging a UniFFI dependency into a Swift package requires building an artifact bundle with the rust sources pre-compiled.
There is a work in progress approach for updating the swift package with release cuts, however it is currently blocked because there is no clear way to update the
Package.swiftfile with new artifact information before a tag is created.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Add
uniffibindings to generate Swift and Kotlin APIs forpdf_inspector, enabling iOS, macOS, and Android integration. Bindings are behind theuniffifeature, with a newuniffi-bindgenhelper binary andstaticlibcrate type for Apple linking.New Features
uniffifeature, build integration, scaffolding, andffimodule.process_pdf(_/bytes),detect_pdf(_/bytes),classify_pdf(_/bytes),extract_text(_/bytes), with unified error mapping.uniffi-bindgenbinary for generating Swift/Kotlin bindings.staticlibcrate type for Swift consumption.Migration
cargo build --release --features unifficargo run --release --features uniffi --bin uniffi-bindgen -- generate --library target/release/libpdf_inspector.dylib --language swift --out-dir swift(use--language kotlinfor Kotlin)Package.swiftupdates outside this PR.Written for commit 74301cc. Summary will update on new commits.