SwiftBasicPay is an open-source example iOS payment application that showcases how to integrate Stellar's powerful payment infrastructure into native Swift apps using the using the Stellar Wallet SDK for Swift and the Stellar iOS SDK.
- Authentication: PIN-based security
- Account Management: Stellar account creation and management
- Asset Management: Add/remove trust lines, asset overview
- Payments: Send and receive Stellar assets
- Path Payments: Cross-asset payments with automatic routing
- Programatic deposits and withdrawals via anchors
- KYC compliance
- Interactive deposits/withdrawals with web integration
SwiftBasicPay integrates multiple Stellar Ecosystem Proposals (SEPs) through the wallet SDK:
- SEP-1: Stellar TOML - Provides anchor metadata and service endpoints
- SEP-10: Web Authentication - Proves account ownership to anchors
- SEP-6: Deposit/Withdrawal API - Traditional REST-based transfer protocol
- SEP-9: Standard KYC Fields - Defines standard customer information fields
- SEP-12: KYC API - Customer information collection and verification
- SEP-24: Hosted Deposit/Withdrawal - Interactive web-based transfers
Sending a path payment with SwiftBasicPay - from selection to confirmation in seconds
- Stellar Wallet SDK: High-level operations for wallet functionality
- Stellar iOS SDK: Core iOS Stellar SDK
┌─────────────────────────────────────┐
│ SwiftUI Views (@Environment) │
└──────────────┬──────────────────────┘
↓
┌─────────────────────────────────────┐
│ DashboardData (@Observable) │
│ ┌────────────────────────────┐ │
│ │ Domain Managers: │ │
│ │ • AssetManager │ │
│ │ • PaymentManager │ │
│ │ • ContactManager │ │
│ │ • KycManager │ │
│ └────────────────────────────┘ │
└──────────────┬──────────────────────┘
↓
┌─────────────────────────────────────┐
│ Service Layer │
│ • StellarService (SDK wrapper) │
│ • AuthService (Authentication) │
│ • SecureStorage (Keychain) │
└──────────────┬──────────────────────┘
↓
┌─────────────────────────────────────┐
│ Stellar SDKs │
│ • stellar-wallet-sdk │
│ • stellar-ios-mac-sdk │
└─────────────────────────────────────┘
- DashboardData: @Observable + @MainActor class for centralized state
- DataState: Enum for async state management (.idle, .loading, .loaded, .error)
- Domain Managers: Specialized managers with caching and performance optimizations
- Service Layer: Abstraction of SDK functionality
- Clone the repository:
git clone https://github.com/Soneso/SwiftBasicPay.git
cd SwiftBasicPay
- Open the project in Xcode:
open SwiftBasicPay.xcodeproj
- Build & Run:
- Scheme: SwiftBasicPay
- Destination: iPhone Simulator
- iOS Deployment Target: 17.5+
SwiftBasicPay/
├── Model/
│ └── DashboardData.swift # Central state manager with domain managers
├── View/
│ ├── ContentView.swift # Root navigation
│ ├── AuthView.swift # Authentication UI
│ ├── Dashboard.swift # Tab navigation
│ ├── Overview.swift # Dashboard home
│ ├── PaymentsView.swift # Payment features
│ ├── AssetsView.swift # Asset management
│ ├── TransfersView.swift # Anchor transfers (SEP-6/24)
│ └── [Additional Views] # Settings, Contacts, KYC, etc.
├── services/
│ ├── StellarService.swift # Stellar SDK wrapper
│ ├── AuthService.swift # Authentication logic
│ └── SecureStorage.swift # Keychain integration
├── common/
│ └── [Utilities] # Errors, helpers, models
└── Assets.xcassets/ # App resources
This app demonstrates how to:
- Create Stellar Wallets: Account generation, key management
- Implement Assets Management: Add and remove trustlines to Stellar assets
- Implement Payments: Simple and path payments
- Interact with Anchors: SEP-1/10/6/12/24 integration
- Ensure Security: Keychain, PIN authentication, secure communication
- Optimize Performance: Caching, parallel requests
A comprehensive tutorial walking through the development of this Stellar payment app is available:
- Tutorial: tutorial
The tutorial covers secure data storage, authentication, account creation, assets management, payments, path payments, and anchor integration with step-by-step explanations of how the Stellar SDKs are used.
This project is licensed under the Apache 2.0 License - see LICENSE for details.
For questions or issues:
- Create an issue
- Consult the Stellar Wallet SDK Documentation
- Consult the Stellar Documentation
Contributions are welcome! Please create a pull request with a clear description of your changes.
Developed by Soneso as a demo implementation for the Stellar community.