SecureWallet-iOS is a fintech-grade iOS project demonstrating a secure wallet and payout pipeline built with Clean Architecture, MVVM, UIKit and strict Test-Driven Development (TDD).
- Designing financial systems where **correctness is prioritised **
- Implementing encryption-at-rest with proper key management
- Building deterministic, replay-based state systems
- Applying modern UIKit architecture (diffable + compositional layout)
- Writing testable, auditable, production-grade iOS code
The project is divided into three primary modules:
SecureWalletApp → iOS Application
SecureWalletDomain → Pure business logic (no frameworks)
SecureWalletData → Infrastructure & implementations
User Action (Add / Spend)
↓
ViewController
↓
ViewModel (state orchestration)
↓
WalletService (use case boundary)
↓
Wallet (domain logic, validation)
↓
WalletStore (persistence boundary)
↓
Core Data (encrypted payload)
↓
Wallet reconstructed via replay
↓
@Published state updated
↓
Diffable snapshot applied
↓
UI reflects new state
The SecureWalletDomain module contains:
The domain module contains all financial rules and invariants.
- Immutable value object storing milliCoins
- Prevents negative values
- Safe arithmetic operations
- Immutable entity
- Credit / Debit direction
- Timestamped
- Owns append-only ledger
- Balance is derived, never stored
- Enforces all financial invariants
- Deterministic persistence representation
- Protocol boundary for persistence
- Balance is never stored directly
- Balance can never be negative
- Debit greater than balance throws
- Debit equal to balance succeeds
- Failed debit does not mutate state
- Ledger entries are append-only
- Duplicate entry IDs are ignored (idempotency)
- Wallet state is reconstructed via deterministic replay
The domain is fully unit tested and framework-agnostic.
This project intentionally uses UIKit to demonstrate production-level iOS engineering skills.
-
UICollectionViewCompositionalLayout- Section-based layout (balance + transaction feed)
- Dynamic sizing using
.estimated - Clean separation via
WalletLayoutFactory
-
UICollectionViewDiffableDataSource- Snapshot-driven UI updates
- Eliminates manual index management
- Ensures UI consistency with state
-
Supplementary Views (Headers)
- Date-grouped transaction sections
- Configured via
supplementaryViewProvider
-
ViewModel exposes state via:
@Published balance@Published transactions
-
UI binding:
Publishers.CombineLatest(viewModel.$balance, viewModel.$transactions)The App layer is responsible for rendering state and handling user interaction.
-
ViewModels:
- Expose state via
@Published - Contain no business logic
- Orchestrate use cases via services
- Expose state via
-
ViewControllers:
- Bind to ViewModel using Combine
- Apply diffable snapshots
- Handle UI composition only
UI is fully state-driven. No business rules exist outside the domain.
The project uses Core Data as a secure persistence engine, storing wallet state as an encrypted payload rather than plain relational data.
Persistence stores encrypted history. Domain reconstructs truth.
- Wallet is not stored directly
- Full state is serialized into a
WalletRecord - Stored as a single encrypted blob
- Domain rebuilds wallet via deterministic replay
Core Data entity:
WalletEntityid: UUIDencryptedPayload: Data
- Convert
Wallet → WalletRecord - Encode using
JSONEncoder - Encrypt using AES-GCM
- Store encrypted payload in Core Data
Wallet (Domain)
↓
WalletRecord
↓
JSON Encode
↓
AES-GCM Encrypt 🔐
↓
Core Data (encryptedPayload)
The project implements encryption-at-rest using Apple’s CryptoKit.
- Wallet data is never stored in plaintext
- Encryption is enforced at the persistence boundary
- AES-256-GCM is used for authenticated encryption
- Keys are generated and stored securely using Keychain
- Decryption failures are treated as data corruption
Wallet → JSON → AES-GCM Encrypt → Core Data
Core Data → AES-GCM Decrypt → WalletRecord → Domain
- Tests are written before implementation
- Domain logic is 100% unit tested
- Infrastructure is tested with mocks
- No Apple system APIs are used directly in tests
Test targets:
- SecureWalletDomainTests
- SecureWalletDataTests
- SecureWalletTests
SecureWallet-iOS focuses on engineering rigor rather than feature breadth.
It is designed to demonstrate how financial systems should be built on iOS: deterministic, testable, and auditable.
