This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Build using xcodebuild directly
make build# Run tests with xcodebuild (includes demo app builds)
make test
# Run tests with CI configuration (includes lint check)
make ci-test
# Run specific test target
xcodebuild -scheme CrossmintClientSDK -destination "platform=iOS Simulator,name=iPhone 16 Pro,OS=latest" test# Run SwiftLint to check for issues
make lint
# Run SwiftLint with auto-fix
make lint-fix
# Using swift package directly
swift package plugin --allow-writing-to-package-directory swiftlint --fix# Build the EVM demo app (SmartWalletsDemo)
make build-evm-demo
# Build the Solana demo app
make build-solana-demo# Clean build artifacts
make clean
# Resolve Swift package dependencies
make resolve
# Open in Xcode
make open
# or double-click "Crossmint SDK.xcworkspace"The Crossmint Swift SDK is a modular iOS SDK for integrating Crossmint services. The architecture follows a clean separation of concerns with distinct modules for different functionalities.
-
CrossmintClient - Main entry point providing the
ClientSDKprotocol implementation- Aggregates all SDK functionality
- Provides access to wallets, authentication, and services
-
Wallet - Smart wallet functionality
- Generic
Walletprotocol with specialized implementations (EVMWallet,SolanaWallet) - Supports multiple signer types (EOA, Passkeys)
- Transaction creation, signing, and management
- Generic
-
Auth - Authentication management
- OTP-based authentication flow
- JWT token management
- Session persistence
-
Payments - Payment processing
- Headless checkout functionality
- Embedded checkout UI components
- Multiple payment method support (crypto, card, express checkout)
-
CrossmintService - Low-level API communication
- Request building and execution
- Error handling
- Environment configuration
- CrossmintCommonTypes - Shared types across modules (blockchains, currencies, etc.)
- SecureStorage - Keychain-based secure storage for sensitive data
- Http - Network layer abstraction
- Logger - Unified logging system
- Utils - Common utilities and extensions
- Passkeys - Passkey authentication support
-
Protocol-Oriented Design: Most functionality exposed through protocols (
ClientSDK,AuthManager,CrossmintWallets,Wallet, etc.) -
Dependency Injection: Modules depend on protocol abstractions rather than concrete implementations
-
Error Handling: Typed errors using Swift's throwing mechanism with specific error types per module
-
Async/Await: Modern Swift concurrency throughout the codebase
-
SwiftUI Integration: Provides environment values and view modifiers for easy SwiftUI integration
When running the demo apps, set these environment variables:
CROSSMINT_API_KEY- Your Crossmint API keyCROSSMINT_WHITELISTED_DOMAIN- Whitelisted domain for the SDK
Tests are organized by module:
- CrossmintCommonTypesTests - Tests for common types
- CrossmintServiceTests - Service layer tests
- WalletTests - Wallet functionality tests
- PaymentTests - Payment processing tests
- UtilsTests - Utility function tests
Test resources (JSON fixtures) are included in each test target's Resources directory.
- All code must pass SwiftLint checks before merging
- Tests run on iPhone 16 Pro simulator by default
- The SDK uses Swift Package Manager for dependency management
- SwiftLint is integrated as a build tool plugin