This guide explains how to integrate the CashuDevKit Swift package into the Signal iOS project, which uses both CocoaPods and Swift Package Manager.
✅ Completed Steps:
- Added cdk-swift repository to the workspace
- Resolved SPM cache issues
- Added local package reference to Signal.xcworkspace
- Verified package builds successfully
- Created integration scaffold (CashuIntegration.swift)
- Open
Signal.xcworkspacein Xcode - In the project navigator, select the
Signalproject (blue icon) - Select the
Signaltarget from the targets list - Go to the General tab
- Scroll to Frameworks, Libraries, and Embedded Content
- Click the + button
- You should see
CashuDevKitfrom the cdk-swift package - select it - Set the embedding option to Do Not Embed (since it's a static library)
Once added to the target, you can import and use it in Swift files:
import CashuDevKit
// Example usage
let wallet = try CashuWallet(...)The file /Signal/src/CashuIntegration.swift has been created with a basic integration scaffold. After adding the dependency:
- Uncomment the
import CashuDevKitline - Implement the TODO methods using actual CashuDevKit APIs
- Add any additional Cashu functionality needed
- CocoaPods: Manages existing Signal dependencies (LibSignalClient, MobileCoin, etc.)
- Swift Package Manager: Manages CashuDevKit and any future Swift packages
- Both can coexist peacefully in the same workspace
Signal-iOS/
├── Podfile # CocoaPods dependencies
├── Signal.xcworkspace/ # Workspace containing both Pods and SPM packages
│ └── xcshareddata/
│ └── swiftpm/ # SPM configuration
├── Signal/
│ └── src/
│ └── CashuIntegration.swift # Cashu integration code
└── ../cdk-swift/ # Local cdk-swift package
If you encounter "already exists in file system" errors:
rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts/*To manually resolve packages:
xcodebuild -resolvePackageDependencies -workspace Signal.xcworkspace -scheme SignalThe cdk-swift package includes a binary target (cdkFFI.xcframework). If you encounter issues:
- Ensure you're using Xcode 13 or later
- Check that the binary checksum matches in Package.swift
- Clean build folder: Product → Clean Build Folder
- Build the Signal target to ensure CashuDevKit links correctly
- Run the existing Signal test suite to ensure no regressions
- Add unit tests for CashuIntegration functionality
Consider where Cashu functionality should appear in the Signal UI:
- Payment settings alongside MobileCoin?
- Separate Cashu wallet section?
- Integration with existing payment flows?
- Cashu wallet keys should be stored securely (Keychain)
- Consider using Signal's existing encryption infrastructure
- Audit token handling and transmission
- Configure mint URLs appropriately for production/staging
- Handle network errors gracefully
- Consider offline token management