Comments (6)
I've been looking into this and have some working code to generate an XCFramework bundle for the Rust binaries.
The reason for using an XCFramework over an old school .framework
bundle is that XCFrameworks can include multiple platforms and architectures. That way we get a singe bundle including binaries for:
aarch64-apple-ios
: iOS devicesx86_64-apple-ios
: iOS Simulators on Intel Macsaarch64-apple-ios-sim
: Simulators on Apple Silicone Macs
This XCFramework bundle can then be dropped into Xcode's Frameworks, Libraries, and Embedded Content section and everything should just work
The one thing that's missing still, in my opinion at least, is including the Swift bindings generated by UniFFI. With my current code, the developer would still have to drop the generated breez_sdk.swift
file from the make swift-ios
step into their Xcode project.
Before continuing to further work on this, I wanted to clarify how we want the final developer experience to be as I believe there's a couple of options:
- Provide a Swift Package that includes the
breez_sdk.swift
Swift bindings generated by UniFFI and the XCFramework containing the Rust binaries: That way the developer could simply add the Swift package to their Xcode project and be done. - Keep what I have on my fork: That way the developer needs to drop both the
breez_sdk.swift
and the XCFramework into their Xcode project. - Somehow compile the
breez_sdk.swift
into the XCFramework. That way the developer needs to drop only the XCFramework into their Xcode project.
Any other ideas? Let me know what you think!
from breez-sdk.
@cnixbtc that looks great!
I think we should explore option 3 as it eventually produces one binary artifact that is self contained and easy for the user to configure.
One of the uniffi output artifact is the .swiftmodule file which is a binary file equivalent to header files for a C framework or library.
I think (although not sure) this file should be embedded inside the framework Modules folder to achieve this goal.
from breez-sdk.
Yeah I agree that would be the nicest developer experience for sure. Unfortunately there's little to no documentation on how to exactly build framework bundles without Xcode. I guess I'll have to do some experimenting to find out how this could be achieved.
from breez-sdk.
I think it is about putting the swiftmofule files 7nder the Modules dir of the framework but perhaps it is better to build with xcode and then open the archive and see where these files are located.
from breez-sdk.
it is about putting the swiftmofule files 7nder the Modules dir of the framework
That's certainly a part of it yes! It looks like there's more to it, though.
A progress update where my head is currently at: As far as I see it there's two options:
As far as I can tell, if we want to produce .framework
bundles, we also need to compile breez_sdk.swift
to a library (linking it to the existing Rust bindings in the process). There's some good info on the internal structure of a .framework
bundle in this article. We'd then have to combine the module definitions and the library into a separate .framework
for each architecture (simulator and device) and pull the frameworks together into a single XCFramework bundle.
There's also the option of creating a XCFramework
directly from static libraries and their header files. Again the official documentation is a bit sparse but this could be a way around needing to construct .framework
bundles first.
I'm looking into how the Swift Package Manager produces binary packages at the moment to try and reverse engineer the best way to do things.
I'll keep reporting my progress here.
from breez-sdk.
After some discussions we decided to go with option 1 as described above. This is a similar approach to how bdk is doing its Swift bindings.
I've added a build step to the Makefile which fully configures a Swift package. This package can then be dropped into any Xcode or SPM managed project. I'll open a PR for that later today.
A second step, that would make developer experience even better, would be setting up a dedicated repo to which we automatically push a fully configured Swift package on every release of the SDK. That could be achieved using GitHub actions. Again, this is what bdk does too.
from breez-sdk.
Related Issues (20)
- Setting log stream does not stream log entries
- Addition of Expiry parameter for invoice creation API
- sdk-react-native iOS/Android example app broken HOT 3
- Repository not found
- Hot reload fails with panic HOT 3
- Support windows target HOT 3
- Publish Flutter package
- Publish dotnet bindings to c# HOT 1
- Flutter: There's no stream for balance changes out of the box HOT 2
- Implement dynamic fee params
- Add webhook API
- Multi-app sync sdk state
- Failure to close multiple channels
- Rect Native binding for backup
- Implement closed_channels using node API
- Tokio runtime crash HOT 5
- Fee calculation and presentation
- send_payment returns Error: payment not found HOT 1
- support parsing nodeID@<ip-address:port> format HOT 1
- send_payment can return ClosedChannel?
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 breez-sdk.