Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift Option<String> and Option<&str> #264

Merged
merged 1 commit into from
Mar 26, 2024
Merged

Swift Option<String> and Option<&str> #264

merged 1 commit into from
Mar 26, 2024

Commits on Mar 26, 2024

  1. Swift Option<String> and Option<&str>

    This commit adds support for passing `Option<String>` to and from
    `extern "Swift"` functions, as well as for passing `Option<&str>` to
    extern "Swift" functions.
    
    For example, the following is now possible:
    
    ```rust
    #[swift_bridge::bridge]
    mod ffi {
        extern "Swift" {
            fn opt_string_function(arg: Option<String>) -> Option<String>;
    
            fn opt_str_function(arg: Option<&str>);
        }
    }
    ```
    
    Note that you can not yet return `-> Option<&str>` from Swift.
    
    This is an uncommon use case, so we're waiting until someone actually
    needs it.
    chinedufn committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    4987f15 View commit details
    Browse the repository at this point in the history