-
Add support for calling async functions when using Swift 6.0+. Now Swift 5.9+ and 6.0+ are supported. #362 (thanks @Choochmeque)
-
Support
Option<String>in shared struct fields. #354 (thanks @Choochmeque)// Rust #[swift_bridge::bridge] mod ffi { #[swift_bridge(swift_repr = "struct")] struct UserProfile { name: String, bio: Option<String>, // Now supported } extern "Rust" { fn create_profile(name: String, bio: Option<String>) -> UserProfile; } }
// Swift // Create with Some value let profileWithBio = UserProfile( name: "Alice".intoRustString(), bio: "Hello world".intoRustString() ) // Create with None value let profileWithoutBio = UserProfile( name: "Bob".intoRustString(), bio: nil ) // Access optional field if let bio = profileWithBio.bio { print("Bio: \(bio.toString())") }
-
Support Rust calls Swift async throwing function. #348 (thanks @Choochmeque)
// Rust #[swift_bridge::bridge] mod ffi { enum SwiftError { SomeError, } extern "Swift" { async fn swift_throwing_function_void(succeed: Bool) -> Result<(), SwiftError>; } }
// Swift func swift_throwing_function_void(succeed: Bool) throws(SwiftError) { if !succeed { throw SwiftError.SomeError } }