Comments (3)
If I have more questions can I just tag you here?
Absolutely!
from swift-bridge.
When you declare FnOnce on a Swift type, it doesn't work. The error output says:
Can you comment with a minimal example bridge module that generates this error?
It looks like considerable work has been done to support FnOnce, but they're not hooked up in bridged_types
Right now we support passing an Box<dyn FnOnce>
from Rust -> Swift. As in, Rust creates the callback and Swift calls the callback.
Is there something about the implementation that needs to be fixed? If so I'd be happy to look into it
Here are some relevant links that should help with adding support for your Box<dyn FnOnce>
case:
swift-bridge/crates/swift-integration-tests/src/boxed_functions.rs
Lines 37 to 53 in af962ca
Please feel free to ask more questions as you go!
from swift-bridge.
Right now we support passing an Box from Rust -> Swift. As in, Rust creates the callback and Swift calls the callback.
I think this was the source of my confusion. I was attempting to send a Closure from Swift to Rust, and call it in Rust. I edited the issue title to reflect this.
Thank you for the implementation guidance! If I have more questions can I just tag you here?
from swift-bridge.
Related Issues (20)
- swift-bridge-build should not emit errors and instead let rustc show errors emitted by the procedural macro HOT 2
- Problem with x86_64-apple-ios-simulator HOT 2
- Add RustVec.intoArray() HOT 1
- SwiftData struct for translating Swift's Data class HOT 1
- extern Swift declaration not public HOT 12
- Xcode reports "Multiple commands produce '...DerivedData...Build/Products/Debug/include/module.modulemap'" HOT 3
- Clippy finds clippy::unnecessary-cast
- Getting these errors in my project HOT 1
- Add an additional XCode + Rust project option HOT 1
- Building for Release HOT 5
- #[swift_bridge::bridge] macro forces module to be private HOT 2
- warning: `extern` block uses type `RustString`, which is not FFI-safe HOT 4
- Book update: Xcode 15 (at least) requires a bridge in order to import into swift
- Can't seem to return refs of custom types HOT 11
- Cannot use two `#[swift_bridge(..)]` attributes on the same function
- Already_declared causes swift generation to never declare Class HOT 1
- Result returns translating incorrectly? HOT 3
- Is &Vec<T> supported? HOT 2
- Cannot for the life of me get Xcode + Cargo to work HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-bridge.