2021-11-22 14:17:03 -08:00
# bdk-swift
2022-11-21 12:59:09 -06:00
This project builds a Swift package that provides [Swift] language bindings for the
[`bdk` ] library. The Swift language bindings are created by the [`bdk-ffi` ] project which is included as a module of this repository.
2021-11-24 14:27:07 -08:00
2022-11-22 20:37:17 -08:00
Supported target platforms are:
2023-01-09 21:36:19 -05:00
- macOS, X86_64 and M1 (aarch64)
2022-11-22 20:37:17 -08:00
- iOS, iPhones (aarch64)
- iOS simulator, X86_64 and M1 (aarch64)
2021-11-24 14:27:07 -08:00
## How to Use
2023-01-09 21:36:19 -05:00
To use the Swift language bindings for [`bdk` ] in your [Xcode] iOS or macOS project add
the GitHub repository https://github.com/bitcoindevkit/bdk-swift and select one of the
2022-11-21 12:59:09 -06:00
release versions. You may then import and use the `BitcoinDevKit` library in your Swift
2021-11-24 14:57:41 -08:00
code. For example:
2021-11-24 14:27:07 -08:00
```swift
import BitcoinDevKit
...
2022-11-21 12:59:09 -06:00
```
2022-11-22 20:37:17 -08:00
Swift Package Manager releases for `bdk-swift` are published to a separate repository (https://github.com/bitcoindevkit/bdk-swift), and that is where the releases are created for it.
2024-06-11 21:03:00 -05:00
The `bdk-swift/build-xcframework.sh` script can be used instead to create a version of the project for local testing.
2022-11-21 12:59:09 -06:00
### How to test
```shell
swift test
2021-11-24 14:27:07 -08:00
```
2022-03-02 20:17:11 -08:00
### Example Projects
2023-11-16 09:40:52 -06:00
* [BDKSwiftExampleWallet ](https://github.com/bitcoindevkit/BDKSwiftExampleWallet ), iOS
2022-03-02 20:17:11 -08:00
2021-11-24 14:27:07 -08:00
## How to Build and Publish
2022-11-21 12:59:09 -06:00
If you are a maintainer of this project or want to build and publish this project to your
2023-01-09 21:36:19 -05:00
own GitHub repository use the following steps:
2022-11-21 12:59:09 -06:00
1. If it doesn't already exist, create a new `release/0.MINOR` branch from the `master` branch.
2022-11-22 20:37:17 -08:00
2. Add a tag `v0.MINOR.PATCH` .
2023-01-09 21:36:19 -05:00
3. Run the `publish-spm` workflow on GitHub from the `bdk-swift` repo for version `0.MINOR.PATCH` .
2021-11-24 14:27:07 -08:00
2021-11-24 14:57:41 -08:00
[Swift]: https://developer.apple.com/swift/
[Xcode]: https://developer.apple.com/documentation/Xcode
2022-11-22 20:37:17 -08:00
[`bdk` ]: https://github.com/bitcoindevkit/bdk
[`bdk-ffi` ]: https://github.com/bitcoindevkit/bdk-ffi