JANUARY, 2023

The Bitcoin Development Kit, or BDK for short, is an open source code package that makes it easy to create and work with on-chain bitcoin wallets. To use BDK in Swift, we’ll use bdk-swift.

To make BDK work seamlessly with SwiftUI, we’ll write a simple manager class that provides UI updates from changes to the bitcoin wallet and takes care of the boiler plate code.

To keep things brief, we’ll save design and UI styling for another day . There are great resources out there to get you started, like the Bitcoin Design Guide and the Bitcoin UIKit, which even has a swift package. - Update: Part 2 with Styling can now be found here!

What we need to do

  1. Create a new SwiftUI project
  2. Add bdk-swift
  3. Create a BDKManager class
  4. Create and load a wallet
  5. Save the wallet
  6. Show WalletView or CreateWalletView on launch
  7. Show balance
  8. Receive bitcoin
  9. Send bitcoin
  10. Show transaction history

This guide assumes some knowledge of developing for iOS with SwiftUI but should be fairly easy to follow. At the time of writing the current version of Xcode is 14, and bdk-swift is at 0.26.0

Want to skip ahead? The complete code for this guide is available on Github.

1. Create a new SwiftUI project