Build the Networking Layer
5 fill-in slots · from The AI Prompt Handbook for Mobile App Development
Your details
0/5 filledBuild the Networking Layer
Background: Native [platform] app, [SwiftUI+Combine / Compose+Kotlin]. API: [REST / GraphQL], auth: [bearer token / other]. I want [URLSession-only / Retrofit / Ktor / undecided]. Use case: Build a reusable, testable networking layer the whole app shares. Implementation details: - A typed request/endpoint definition and JSON decoding (Codable / kotlinx.serialization / Moshi) - Surface typed domain errors, not raw transport errors - Bearer-token auth with automatic refresh on 401 and request retry - Timeouts, retry-with-backoff for transient failures, and cancellation tied to the screen lifecycle - iOS: expose async/await or Combine publishers; Android: suspend functions or Flow - A protocol/interface seam so it's mockable in tests Layer & dependencies: Lives in the data layer behind an interface; the repository consumes it, the UI never sees URLs or status codes. Deliverable: The API client interface, one concrete implementation, the error type, the auth-refresh flow, and a worked example of mocking the client in a unit test.
Highlighted [slots] are still empty. Downloads are plain .txt — paste into any AI assistant.