Design a Repository Layer
3 fill-in slots · from The AI Prompt Handbook for Mobile App Development
Your details
0/3 filledDesign a Repository Layer
Background: Native [platform] app, [SwiftUI+Combine / Compose]. I have these data sources: [e.g., REST API, local database, in-memory cache, key-value store]. The domain works with these models: [list]. Use case: Design a repository layer that hides where data comes from, so the rest of the app asks for data without knowing it's remote, cached, or local. Implementation details: - A repository interface per domain area, exposing domain models (not raw DTOs) - A single-source-of-truth / offline-first strategy: serve cache, refresh from network, emit updates - iOS: expose Combine publishers (or async/await) to callers - Android: expose Kotlin Flow (or suspend functions) to callers - Where DTO-to-domain mapping happens, and where errors are translated Layer & dependencies: Repository lives in the data layer behind a domain-defined interface; the domain/UI never imports networking or persistence types directly. Deliverable: The repository interface, a concrete implementation coordinating network + local sources with the offline-first flow, the mapping layer, and a note on how view models consume it.
Highlighted [slots] are still empty. Downloads are plain .txt — paste into any AI assistant.