Releases: chinedufn/swift-bridge
0.1.37
- 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
0.1.35: Add example of Rust linking in Swift (#104)
- Users no longer need to specify a
SWIFT_BRIDGE_OUT_DIR
environment variable. #104
0.1.34: Generate public initializers for shared structs (#101)
0.1.33
This release brings support for bridging Rust generic types such as
SomeType<String, u32>
, as well as a couple new function attributes
that make certain use cases a bit more ergonomic.
For example, the following is now possible:
#[swift_bridge::bridge]
mod ffi {
extern "Rust" {
// Declare the generic type once.
#[swift_bridge(declare_generic)]
type MyType<A, B>;
}
extern "Rust" {
// Bridge as many monomorphic types as you like.
type MyType<u32, String>;
fn some_function(arg: MyType<u32, String>) -> &str;
type MyType<i8, Vec<u8>>;
}
}
pub struct MyType<T, U> {
my_field1: T,
my_field2: U
}
fn some_function(arg: MyType<u32, String>) -> &str {
unimplemented!()
}
-
Support bridging generic opaque Rust types such as
MyType<u32>
#81 -
Support Option generic opaque Rust types such as
Option<MyType<u32>>
#87 -
Support bridging generic opaque Rust Copy types such as
chrono::DateTime<Utc>
#84 -
Support Option opaque Rust copy types such as
Option<MyCopyType>
#85 -
Introduce
get
andget_with
attributes to directly access a field without going through a function #82 -
Better compile time errors for unrecognized attributes #83
-
Deprecate
into_return_type
attribute in favor ofreturn_into
#73 #95 (thanks @Pouria-007)
0.1.32
- Introduce the
#[swift_bridge(Copy)]
attribute for efficiently passing opaqueCopy
types between Rust and Swift #63#[swift_bridge::bridge] mod ffi { extern "Rust" { #[swift_bridge(Copy(16))] type UserId; #[swift_bridge(Copy(16))] type OrganizationId; } } #[derive(Copy, Clone)] struct UserId(uuid::Uuid); #[derive(Copy, Clone)] struct OrganizationId(uuid::Uuid);
0.1.31
0.1.30
0.1.29
-
Add
swift_bridge_build::create_package
API for creating a Swift Package from a Rust library #36 (Thanks @Jomy10) -
Add
swift-bridge create-package
CLI command for creating a Swift Package from a Rust library #38 (Thanks @Jomy10) -
Update the Swift Package book chapter with the new API and CLI command for creating swift packages (Thanks @Jomy10)