SwiftUI components for displaying Algorand Standard Assets (ASAs) using the Pera Wallet API.
- Asset List View - Paginated list with infinite scroll
- Asset Detail View - Comprehensive asset information display
- Search - Filter assets by name
- Remote Image Loading - Async image loading with caching via AppState
- Navigation Ready - Built-in NavigationLink support
- iOS 16.0+
- Swift 6.0+
- Xcode 16.0+
Add ASAViewer to your project using Swift Package Manager:
dependencies: [
.package(url: "https://github.com/CorvidLabs/swift-asa-viewer.git", branch: "main")
]import ASAViewer
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationStack {
ASAViewer()
}
}
}The library uses protocol-based dependency injection for testability:
import ASAViewer
// Create a mock service for testing
actor MockASAService: ASAServiceProtocol {
func fetchAssets(page: String?) async throws -> AssetList {
// Return mock data
}
func fetchAssetDetail(_ id: Int) async throws -> Asset {
// Return mock asset
}
}
// Inject into ViewModel
let viewModel = ASAViewerViewModel(service: MockASAService())import ASAViewer
// Fetch assets directly
let service = ASAService()
let assetList = try await service.fetchAssets()
for asset in assetList.results {
print("\(asset.name) (ID: \(asset.assetID))")
print(" Verification: \(asset.verificationTier)")
print(" USD Value: \(asset.usdValue ?? "N/A")")
}
// Fetch specific asset details
let usdc = try await service.fetchAssetDetail(31566704)
print(usdc.description ?? "No description")The main SwiftUI view that displays a paginated list of Algorand assets with search functionality.
Service for fetching asset data from the Pera Wallet API:
fetchAssets(page:)- Fetches paginated list of assetsfetchAssetDetail(_:)- Fetches detailed info for a specific asset
Comprehensive model including:
- Basic info:
assetID,name,unitName,logo - Supply info:
totalSupply,circulatingSupply,fractionDecimals - Verification:
verificationTier,verificationDetails - Collectible info:
isCollectible,collectible - Pricing:
usdValue,usdValue24HourAgo
Full API documentation is available at: https://corvidlabs.github.io/swift-asa-viewer/
- AppState - State management for image caching
MIT License - Copyright 2026 Corvid Labs