-
Notifications
You must be signed in to change notification settings - Fork 231
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
UniFFI fails to generate Swift bindings in my project #2324
Comments
Downgrading to Does NOT work on 0.27.3 or 0.28.3 #[uniffi::constructor]
pub fn new(
id: Option<String>,
id2: String,
id3: Option<String>,
loaded: bool,
) -> Option<Arc<Self>> {
todo!();
} Works on both #[uniffi::constructor]
pub fn new(
id: Option<String>,
id2: String,
id3: Option<String>,
loaded: bool,
) -> Arc<Self> {
todo!();
} But at least 0.27.3 complains, which makes it possible to temp fix. I would really like the constructor to be able to return |
WorkaroundIt's possible to work around by adding another layer of indirection, by storing the optional result in another object and then using a regular self-method to fetch it. |
We've had a bunch of philosophical discussions over the years on what exactly a "constructor" is. IMO, a constructor should not be able to return
|
As long as the problem is solvable (easily solvable as soon as I understood the problem) I'm fine with whatever you propose. I must say, I converted my code from |
Hello, I am using a
staticlib
-only iOS project with UniFFI, and I am having some trouble generating Swift bindings.I have a small proof-of-concept here https://github.com/bes/uniffi-2024-11-poc
When I run the
build.sh
script, the output is:Rust:
The text was updated successfully, but these errors were encountered: