Use this prompt to get started quickly.
Prerequisites
- iOS 14+ or macOS 14+, with Xcode 15+ (Swift 5.9+)
Getting started
1
Install the SDK
- Xcode
- Package.swift
In Xcode, go to File > Add Package Dependencies and enter the package URL:For Dependency Rule, select Exact Version and enter
0.25.0. Then add the Bark product to your app target.2
Create a wallet
Generate a BIP39 mnemonic, configure the signet endpoints, and open the wallet in a data directory.
Wallet.open() creates the wallet on the first launch and reopens it on later ones.Run the code from this step and the next two inside an async throws function or a Task, with the import lines at the top of the file.3
Get a receiving address
Generate an Ark address to receive bitcoin.Run your app to print the address. In Xcode,
print() output appears in the console. Send some signet sats to this address using the faucet.4
Check your balance
Bark syncs the wallet in the background while it’s open. Call Balance amounts are
sync() when you need an up-to-date balance right away.UInt64 values.Run your app again. It reopens the same wallet and prints your spendable balance in sats.Next steps
Source code
Swift bindings source on GitLab.
How Ark works
Learn about the protocol powering your wallet.