Apply Reactive / Observer Patterns
1 fill-in slot · from The AI Prompt Handbook for Mobile App Development
Your details
0/1 filledApply Reactive / Observer Patterns
Background: Native [platform] app. iOS uses Combine; Android uses Kotlin Flow. Here's the reactive scenario I'm modeling: [describe—e.g., search-as-you-type, combining auth state with profile data, a stream that several screens observe] Use case: Implement this with idiomatic reactive operators instead of manual callbacks and mutable shared state. Implementation details: - iOS (Combine): pick the right operators (map, flatMap, combineLatest, debounce, removeDuplicates, switchToLatest) and handle cancellation with the SwiftUI lifecycle - Android (Flow): pick the right operators (map, flatMapLatest, combine, debounce, distinctUntilChanged, stateIn) and the right collection scope - Handle errors within the stream (don't let one failure kill it) - Avoid retain cycles (iOS) / leaked collectors (Android) Layer & dependencies: The stream is owned by the view model / state holder and exposed as read-only state to the view. Deliverable: The reactive pipeline for both platforms (or just mine), with operator choices explained, error handling, and the common pitfall to watch for in this specific scenario.
Highlighted [slots] are still empty. Downloads are plain .txt — paste into any AI assistant.