Skip to content

SPM setup for rust library #280

Description

@qiweiii

Problem

#[swift_bridge::bridge]
mod ffi {
    // Export opaque Rust types, functions and methods for Swift to use.
    extern "Rust" {
        type RingContext;
        type IetfProof;
        type Input;
        type Output;
        type Public;
        type RingProof;
        type Secret;

        type IetfVrfSignature;

        fn ring_context() -> &'static RingContext;

        fn vrf_input_point(vrf_input_data: &[u8]) -> Input;
    }
}

I have this setup for a swift package, I want to access a generated function in swift, and have the following error:

image

It's probably sth wrong with my setup, and I didn't follow https://chinedufn.github.io/swift-bridge/building/swift-packages/index.html as my pacakge later will also need to be run on linux, so I followed https://chinedufn.github.io/swift-bridge/building/swiftc-and-cargo/index.html and tried to make it work in spm

I also tried to include generated folder in sources, but it will give lots of errors like error: cannot find '__swift_bridge__$xxx$xxxx' in scope from generated .swift files

Please check if this scenario can be solved, thanks in advance

Steps

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions