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

swift package doesn't support macOS, watchOS etc... #367

Open
cedricloneux opened this issue Jun 9, 2023 · 5 comments
Open

swift package doesn't support macOS, watchOS etc... #367

cedricloneux opened this issue Jun 9, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@cedricloneux
Copy link

I am working on a cross-platform app that should work on all Apple's systems. iOS, macOS, watchOS
When I tried to run the Mac app, I was blocked by this error message saying that the package is not compatible.
image

Would it be possible to fix that issue and support all platforms?

@cedricloneux cedricloneux added the enhancement New feature or request label Jun 9, 2023
@notmandatory
Copy link
Member

Our bdk-swift swift package does include MacOS (M1 and x86), plus the iOS (including M1 and x86 simulator). For watchOS support, it looks like it has tier 3 support for rust (https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/apple-watchos.md) so we might be able to support it.

@notmandatory
Copy link
Member

I noticed also you're using Mac Catalyst, is any available swift package supposed to work with it? I haven't used it before.
https://developer.apple.com/mac-catalyst/

@notmandatory
Copy link
Member

It looks like there may be some additional xcframework packaging voodoo to get them to work with Catalyst:

https://developer.apple.com/documentation/xcode/creating-a-multi-platform-binary-framework-bundle#Create-archives-for-frameworks-or-libraries

@notmandatory
Copy link
Member

I made a simple test MacOS app, added package bdk-swift 0.28, imported it and used a couple BDK functions and it worked fine for me. Note I did not try to use Catalyst.

@reez
Copy link
Collaborator

reez commented Apr 30, 2024

As notmandatory mentioned everything works for a macOS app, but Mac Catalyst has some interesting nuances to get it working for a framework like bdk-swift; but I think we can make this happen or at least I'd like to try it out with something like adding this in our workflows (bdk-ffi + bdk-swift):

name: "Install Rust targets"

rustup target add aarch64-apple-ios-macabi # Mac Catalyst ARM64
rustup target add x86_64-apple-ios-macabi # Mac Catalyst x86_64

name: "Build bdk-ffi for all targets"

cargo build --profile release-smaller --target aarch64-apple-ios-macabi
cargo build --profile release-smaller --target x86_64-apple-ios-macabi

name: "Create universal binary for Mac Catalyst"

mkdir -p target/universal/release-smaller
    lipo -create \
      target/aarch64-apple-ios-macabi/release/libbdkffi.a \
      target/x86_64-apple-ios-macabi/release/libbdkffi.a \
      -output target/universal/release-smaller/libbdkffi_catalyst.a

... and so on.

@cedricloneux do you still have a need for Mac Catalyst support?

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

3 participants