Skip to content

Releases: chinedufn/swift-bridge

0.1.45

12 Jan 13:47
cc8746c
Compare
Choose a tag to compare
  • Support the swift_name attribute on extern "Rust" exported functions. #128 (thanks @bes)

     // For example, the following is now possible
    
     #[swift_bridge::bridge]
     mod ffi {
         extern "Rust" {
             #[swift_bridge(swift_name = "someFunction")]
             fn some_function();
         }
     }
  • Make RustVec methods public. #131 (thanks @onato)

0.1.44

15 Dec 21:19
36683f8
Compare
Choose a tag to compare
  • Make enums support the swift_name attribute. #126

    // For example, the following is now possible:
    
    #[swift_bridge::bridge]
    mod ffi {
        #[swift_bridge(swift_name = "EnumRename")]
        enum EnumName {
            Variant1,
            Variant2,
        }
    }
  • Fix using the return_into attribute an already declared enum. #127

     // For example, the following is now possible:
    
     #[swift_bridge::bridge]
     mod ffi {
         #[swift_bridge(already_declared)]
         enum SomeEnum {}
     
         extern "Rust" {
             #[swift_bridge(return_into)]
             fn return_into_already_declared() -> SomeEnum;
         }
     }

0.1.43

15 Dec 17:29
d921eec
Compare
Choose a tag to compare
  • Show a spanned compile time error for invalid module items. #124

    #[swift_bridge::bridge]
    mod ffi {
        use std;
        fn foo() {}
    }
    
    // error: Only `extern` blocks, structs and enums are supported.
    //  --> tests/ui/invalid-module-item.rs:6:5
    //   |
    // 3 |     use std;
    //   |     ^^^^^^^^
    //
    // error: Only `extern` blocks, structs and enums are supported.
    //  --> tests/ui/invalid-module-item.rs:7:5
    //   |
    // 4 |     fn foo() {}
    //   |     ^^^^^^^^^^^
  • Allow enums to use the #[already_declared] attribute. #125

     // For example, the following is now possible:
    
     use some_other_bridge_module::SomeEnum;
     
     #[swift_bridge::bridge]
     mod ffi {
         #[swift_bridge(already_declared)]
         enum SomeEnum {}
     
         extern "Rust" {
             fn print(val: SomeEnum);
         }
     }

0.1.42

15 Dec 02:12
bb46ca6
Compare
Choose a tag to compare
  • Support returning String from Swift -> Rust #123 (thanks @bes)
    // For example, the following is now possible:
    
    #[swift_bridge::bridge]
    mod foo {
        extern "Swift" {
            fn some_function () -> String;
        }
    }

0.1.41

28 Oct 19:38
e2da694
Compare
Choose a tag to compare
  • Support Vec<TransparentEnum> #117
    // For example, the following is now possible:
    
    #[swift_bridge::bridge]
    mod ffi {
        enum SomeEnum {
            VariantA,
            VariantB,
        }
    
        extern "Rust" {
            fn some_function(arg: Vec<SomeEnum>) -> Vec<SomeEnum>;
        }
    }

0.1.40

03 Oct 21:51
59bff34
Compare
Choose a tag to compare
  • Support opaque Swift types in results #115
    // For example, the following is now possible:
    
    #[swift_bridge::bridge]
    mod ffi {
        extern "Swift" {
            type SomeSwiftType;
    
            fn some_function(arg: Result<(), SomeSwiftType>);
        }
    }

0.1.39: Fix Box<dyn FnOnce> trailing comma (#113)

02 Oct 11:14
1e2cbf4
Compare
Choose a tag to compare
  • Fix compile time error from trailing commas after a boxed FnOnce #113
    // For example, the following is now possible:
    
    #[swift_bridge::bridge]
    mod ffi {
        extern "Swift" {
            fn swift_func_takes_callback(
                // Note the trailing comma after the `FnOnce(..)`
                arg: Box<dyn FnOnce(Result<SomeRustType, String>), >
            );
        }
    }

0.1.38

20 Sep 23:32
a955496
Compare
Choose a tag to compare
  • Add support for Result<T, E> #111
    // For example, the following is now possible:
    
    use some_crate::SomeRustType;
    
    #[swift_bridge::bridge]
    mod ffi {
        extern "Swift" {
            fn swift_func_takes_callback(
                arg: Box<dyn FnOnce(Result<SomeRustType, String>)>,
            );
        }
    
        extern "Rust" {
            type SomeRustType;
    
            #[swift_bridge::init]
            fn new () -> SomeRustType;
        }
    }

0.1.37

15 Sep 16:31
2ad1757
Compare
Choose a tag to compare
  • Support passing callbacks from Rust -> Swift #110
    // For example, the following is now possible:
    #[swift_bridge::bridge]
    mod ffi {
        extern "Swift" {
            type StripeTerminalSingleton;
    
            #[swift_bridge(init)]
            fn new() -> StripeTerminalSingleton;
    
            fn retrieve_payment_intent(
                &self,
                client_secret: &str,
                callback: Box<dyn FnOnce(Result<PaymentIntentWrapper, String>)>,
            );
    
            fn collect_payment_method(
                &self,
                payment_intent: PaymentIntentWrapper,
                callback: Box<dyn FnOnce(Result<PaymentIntentWrapper, String>)>,
            );
    
            fn process_payment(
                &self,
                payment_intent: PaymentIntentWrapper,
                callback: Box<dyn FnOnce(Result<PaymentIntentWrapper, ProcessPaymentError)>,
            );
        }
    }

0.1.36

23 Aug 17:14
4c5fe2d
Compare
Choose a tag to compare
  • Support returning opaque Swift types from Swift -> Rust #109
    // For example, the following is now possible:
    #[swift_bridge::bridge]
    mod ffi {
        extern "Swift" {
            type SomeType;
    
            fn some_function(arg: SomeType) -> SomeType;
            fn some_method(&self, arg: SomeType) -> SomeType;
        }
    }