ChatGPT Prompt for Mobile Dev
Implement the Redux/state management pattern in SwiftUI with practical code structure and examples.
More prompts for Mobile Dev.
Conduct a comprehensive mobile app performance audit covering startup time, rendering, memory, network, and battery usage.
Complete ASO strategy for a e-commerce app in the cybersecurity space to maximize downloads.
Implement the Feature-based modularization pattern in Jetpack Compose with practical code structure and examples.
Implement the Unidirectional data flow pattern in React Native + TypeScript with practical code structure and examples.
Complete ASO strategy for a language learning app in the travel space to maximize downloads.
Complete ASO strategy for a meditation app in the biotech space to maximize downloads.
You are an expert senior mobile developer with deep expertise in mobile architecture. Implement the **Redux/state management** pattern in a SwiftUI mobile application. **Pattern:** Redux/state management **Framework:** SwiftUI **Complexity:** advanced production-grade ## Pattern Overview - Define Redux/state management in the context of mobile development - Why this pattern matters for SwiftUI apps specifically - When to use it vs. simpler alternatives - Prerequisites and concepts developers should understand first ## Implementation Architecture ### Project Setup - Dependencies and packages needed for this pattern - Configuration changes required - File structure for organizing pattern-related code ### Core Implementation Walk through building the Redux/state management pattern step by step: 1. **Foundation Layer** - Define the base types, interfaces, or abstract classes - Set up the core data structures the pattern requires - Explain the naming conventions to follow 2. **Business Logic Layer** - Implement the main logic components - Show how data flows through the pattern - Handle loading, error, and success states 3. **UI Integration Layer** - Connect the pattern to SwiftUI UI components - Reactive UI updates when state changes - Handle user interactions through the pattern 4. **Side Effects and Async Operations** - Network requests through the pattern - Local database operations - Platform API calls (camera, location, notifications) ## Real-World Example Build a complete feature using this pattern: - Feature: User profile with edit capability - Show every file that needs to be created or modified - Describe the data flow for loading, editing, and saving a profile - Handle offline scenarios and optimistic updates ## Testing the Pattern - How to unit test each layer independently - Mock strategies for dependencies - Integration test for the complete pattern flow - Common testing mistakes with this pattern ## Common Mistakes and How to Avoid Them List 7 common mistakes developers make when implementing Redux/state management: - The mistake and why it happens - The correct approach - How to detect the mistake in code review ## Performance Considerations - Memory impact of this pattern - Does it add meaningful overhead on mobile devices? - Optimization tips specific to SwiftUI - Use precise technical terminology appropriate for the audience - Include code examples, configurations, or specifications where relevant - Document assumptions, prerequisites, and dependencies - Provide error handling and edge case considerations Organize your output using a clear framework with labeled sections. Each section should build on the previous one.