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

Make enums support the swift_name attrib #126

Merged
merged 1 commit into from
Dec 15, 2022
Merged

Conversation

chinedufn
Copy link
Owner

This commit makes enums support the swift_name attribute, which lets
you choose the name that shows up on the Swift side.

For example, the following is now possible:

#[swift_bridge::bridge]
mod ffi {
    #[swift_bridge(swift_name = "EnumRename")]
    enum EnumName {
        Variant1,
        Variant2,
    }
}

This commit makes enums support the `swift_name` attribute, which lets
you choose the name that shows up on the Swift side.

For example, the following is now possible:

```rust
#[swift_bridge::bridge]
mod ffi {
    #[swift_bridge(swift_name = "EnumRename")]
    enum EnumName {
        Variant1,
        Variant2,
    }
}
```
@chinedufn chinedufn merged commit 819e391 into master Dec 15, 2022
@chinedufn chinedufn deleted the fix-enum-swift-name branch December 15, 2022 20:03
@bes
Copy link
Contributor

bes commented Dec 17, 2022

This should complete everything I asked about in #122 ?

@chinedufn
Copy link
Owner Author

This doesn't add support for swift_name on Rust functions, so #122 is still open.

We essentially need to change this

To something along the lines of:

if let Some(swift_name) = &function.swift_name_override {
    format!("public func {}", swift_name.value())
} else {
    format!("public func {}", fn_name.as_str())
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants