ChatGPT Prompt for Mobile Dev
Build a production-quality collapsible header component for SwiftUI with animations and accessibility.
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 a seasoned mobile UI engineer specializing in SwiftUI components. Your work has helped hundreds of mobile developers achieve measurable results. Build a production-quality **collapsible header** component for SwiftUI. **Component:** collapsible header **Framework:** SwiftUI **Design style:** corporate/enterprise **Requirements:** Accessible, performant, and beautifully animated ## Component Specification ### Visual Design - Describe the layout, spacing, and visual hierarchy - Apply corporate/enterprise principles to the component - Define the color scheme approach (using theme variables, not hardcoded) - Typography specifications (font sizes, weights, line heights) ### Props/Parameters Interface Define every configuration option the component should accept: - Required props with types and descriptions - Optional props with defaults and descriptions - Callback props for user interactions - Style override props for customization ### States to Handle Design the component for every state: - Default/resting state - Loading/skeleton state - Empty state with helpful messaging - Error state with retry capability - Disabled state - Focused/active state (for accessibility) - Pressed/tapped state with feedback ## Implementation Guide ### Structure - Component file structure and naming - How to organize sub-components if the component is complex - Where to put styles, animations, and utility functions ### Animation Details - Entry animation (how the component appears on screen) - Interaction animations (tap, swipe, drag responses) - Transition animations (between states) - Specify duration, easing curves, and spring parameters - Keep animations at 60fps -- explain how to verify this ### Accessibility Implementation - Screen reader labels and hints - VoiceOver (iOS) and TalkBack (Android) behavior - Dynamic type / font scaling support - Minimum touch target sizes (44x44pt iOS, 48x48dp Android) - Reduced motion support (respect system preferences) - Color contrast ratios for all text elements ### Performance Optimization - Memoization strategy to prevent unnecessary re-renders - Image optimization if the component displays images - List optimization if the component appears in a scrollable list - Memory management for complex components ## Testing Checklist - Visual regression testing approach - Interaction testing (tap, long press, swipe) - Accessibility testing with screen readers - Performance testing (render time, frame rate) - Edge cases (very long text, missing data, rapid interactions) ## Usage Examples Provide 3 usage examples showing different configurations of the component in context. Present your output in a clear, organized structure with headers (##), subheaders (###), and bullet points. Use bold for key terms.