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

[Research Spike] Distribute over Swift Package Manager #296

Closed
pacu opened this issue Aug 24, 2021 · 7 comments
Closed

[Research Spike] Distribute over Swift Package Manager #296

pacu opened this issue Aug 24, 2021 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@pacu
Copy link
Contributor

pacu commented Aug 24, 2021

As a wallet developer I would like to be able to import ZcashLightClientKit as a Swift Package instead of being forced to use Cocoapods

@pacu pacu added the enhancement New feature or request label Aug 24, 2021
@pacu pacu self-assigned this Aug 24, 2021
@pacu
Copy link
Contributor Author

pacu commented Aug 24, 2021

https://developer.apple.com/videos/play/wwdc2019/416/

Binary Frameworks in Swift
Xcode 11 now fully supports using and creating binary frameworks in Swift. Find out how to simultaneously support devices and Simulator with the new XCFramework bundle type, how Swift module interfaces work, and how to manage changes to your framework over time.

Idea:
Extract Rust code to its own project and create an XCFramework with it. LibrustZcash does not change often enough that it's actually a burden to maintain long term

@pacu
Copy link
Contributor Author

pacu commented Aug 24, 2021

Making Cocoapods support XCFrameworks as a way of transitioning to SPM
https://anuragajwani.medium.com/distributing-universal-ios-frameworks-as-xcframeworks-using-cocoapods-699c70a5c961

@pacu pacu assigned pacu and unassigned pacu Aug 25, 2021
@pacu
Copy link
Contributor Author

pacu commented Aug 25, 2021

Experiences on XCFramework and Rust
https://developer.apple.com/forums/thread/650511

@pacu
Copy link
Contributor Author

pacu commented Aug 25, 2021

Rust + XCFramework + SPM
rust-lang/rust#79408

@r3ld3v r3ld3v added this to the Wallet Sprint 2021-34 milestone Aug 26, 2021
@pacu
Copy link
Contributor Author

pacu commented Aug 30, 2021

@pacu
Copy link
Contributor Author

pacu commented Aug 31, 2021

There are two approaches to distribute the package using SPM

  1. Building a static framework of the whole SDK so that developers add the SDK as a binary dependency
    this entails creating a repo for the sdk for this purpose and uploading the binary with the same semver than the cocoapods version.
    the downsides of this approach are:
  • local development is probably harder
  • access to the source code is lost, only generated interfaces are available which limits learning opportunities and could hurt the ability of developers to send PRs upstream on easy fixes.
  1. work on a layered solution that allows the SDK to be distributed as an open sourced repo that uses a binary dependency containing the rust build.
    we need to abstract away the rust layer on a separate repo with the rust welding layer now being a public interface.
    A binary framework is built and published from that repo using dependency managers (SPM and Cocoapods). This framework has its own semantic versioning and can be consumed by other tools as is.
    The ZcashLightClientKit framework depends on this other framework
    the downsides of this approach are:
  • code is spread apart on many places, implementing a this with the code as is could add complexity to the daily dev environment and make refactoring more difficult
  • requires careful handling of the rust code versioning

@pacu pacu closed this as completed Sep 1, 2021
@pacu
Copy link
Contributor Author

pacu commented Oct 3, 2021

Interesting finding by Hasan Ali Atak

https://github.com/mozilla/rust-components-swift

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

No branches or pull requests

2 participants