-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2a2073
commit d760730
Showing
3 changed files
with
42 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,23 @@ | ||
# bdk-swift | ||
|
||
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 git submodule of this repository. | ||
This project is only used to publish a [Swift] package manager package called `bdk-swift` with language bindings and corresponding bdkFFI.xcframework for the | ||
`BitcoinDevKit` framework created by the [bdk-ffi] project. The Swift language bindings files are created by the [bdk-ffi] `./bdk-ffi` sub-project which are copied into, committed and tagged in this `bdk-swift` repo by the `publish-spm` github actions workflow. | ||
|
||
## How to Use | ||
|
||
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 | ||
release versions. You may then import and use the `BitcoinDevKit` library in your Swift | ||
code. For example: | ||
|
||
```swift | ||
import BitcoinDevKit | ||
|
||
... | ||
let desc = "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)" | ||
let databaseConfig = DatabaseConfig.memory | ||
let wallet = try Wallet.init(descriptor: desc, changeDescriptor: nil, network: Network.regtest, databaseConfig: databaseConfig) | ||
let addressInfo = try wallet.getAddress(addressIndex: AddressIndex.new) | ||
``` | ||
Any changes to the `bdk-swift` Swift package must be made via the [bdk-ffi] repo. | ||
|
||
### Example Projects | ||
|
||
* [BdkSwiftSample](https://github.com/futurepaul/BdkSwiftSample) | ||
|
||
## How to Build and Publish | ||
## How to Use | ||
|
||
If you are a maintainer of this project or want to build and publish this project to your | ||
own Github repository use the following steps: | ||
To use the Swift language bindings for `BitcoinDevKit` in your [Xcode] iOS or MacOS project: | ||
|
||
1. If it doesn't already exist, create a new `release/0.MINOR` branch from the `master` branch | ||
2. Run the `publish-spm` workflow on Github for branch `release/0.MINOR` and version `0.MINOR.0` | ||
3. Copy the changelog from corresponding `bdk-ffi` release description to this release | ||
1. Add the "bdk-swift" package from the repo https://github.com/bitcoindevkit/bdk-swift and select one of the latest minor versions. | ||
2. Add the `BitcoinDevKit` framework in your Target config. | ||
3. Import and use the `BitcoinDevKit` library in your Swift code. For example: | ||
```swift | ||
import BitcoinDevKit | ||
|
||
... | ||
``` | ||
|
||
[Swift]: https://developer.apple.com/swift/ | ||
[Xcode]: https://developer.apple.com/documentation/Xcode | ||
[`bdk`]: https://github.com/bitcoindevkit/bdk | ||
[`bdk-ffi`]: https://github.com/bitcoindevkit/bdk-ffi | ||
["Getting Started (Developer)"]: https://github.com/bitcoindevkit/bdk-ffi#getting-started-developer | ||
[bdk-ffi]: https://github.com/notmandatory/bdk-ffi |
Submodule bdk-ffi
deleted from
064807