$ show gemwalletcom/gem-ios
Gem Wallet is a production-grade, self-custodial multi-chain cryptocurrency wallet for iOS (and partially macOS), built entirely with SwiftUI and heavily modularized via Swift Package Manager. The system manages private keys securely via the Keychain and WalletCore, supports 40+ blockchains (Bitcoin, Ethereum, Solana, Cosmos, TON, etc.), and provides full DeFi capabilities: token transfers with fee estimation and simulation, token swaps with provider selection and price impact analysis, staking with delegation and rewards, perpetual trading (Hyperliquid) with leverage and position management, fiat on/off-ramp through third-party providers, NFT viewing and management, WalletConnect dApp connections, price alerts, and a home-screen price widget. Architecture follows an MVVM pattern with protocol-oriented service layers, a centralized dependency injection container (AppResolver), and local persistence via GRDB (SQLite) backed by observable queries for reactive UI updates. Network communication uses a custom HTTP client with device-signed requests and WebSocket streams for real-time balances, prices, and notifications. The codebase is unusually well-tested with dedicated TestKit targets providing mock services for every major component, and extensive unit, UI, and snapshot tests. Despite its size (40+ packages), the modular boundaries are well-observed, with clear abstractions for signing, chain services, and UI components. The project relies on a Rust binary framework (Gemstone) for core blockchain logic, which introduces a build dependency but is managed via a regenerate script. Overall, this is a highly professional, actively maintained iOS application with strong engineering practices.
The LLM identified 5 files worth highlighting for reuse:
Provides a generic, reusable mechanism to bind GRDB database queries to SwiftUI views with automatic re-fetch on filter changes. The pattern is self-contained within the Store package and can be extracted for any project needing reactive SQLite access.
A robust formatter for large numbers (BigInt/BigDecimal) with configurable precision, rounding modes, and locale-aware grouping. It is completely isolated (no dependency on internal project types) and solves a common crypto/finance problem. Accompanied by thorough unit tests.
A concrete implementation of the Keychain protocol that wraps iOS Keychain operations with proper error handling, accessibility levels, and biometric policy support. The protocol design allows easy swapping with mocks for testing. The file is self-contained and reusable in any iOS project requiring secure credential storage.
A completely self-contained, customizable toast display component built as a SwiftUI ViewModifier. It handles presentation, animation, and dismissal with a clean API. This pattern is generic enough to be extracted verbatim into any SwiftUI project.
A set of Swift property wrappers (CodableDefaults, ConfigurableDefaults) that simplify storing and reading Codable types in UserDefaults with optional automatic synchronization. The wrappers are self-contained, generic, and demonstrate a non-trivial mastery of property wrappers and Combine. They can be copy-pasted into any project needing type-safe defaults.