AI generated prompt for SwiftUI View with Animations
Ask questions or share concrete improvements.
No comments yet.
Sign in to join the discussion.
**Context**: Design a reusable SwiftUI view that incorporates animations to enhance the user experience. The view should be versatile and adaptable to various applications, including but not limited to, onboarding processes, tutorial screens, or interactive dashboards. The goal is to create an engaging and dynamic visual element that captures the user's attention and provides a seamless interaction experience. **Detailed Instructions**: 1. Develop a SwiftUI view that includes at least three different animation effects. These effects could range from scaling, fading, to more complex animations like rotations or spring animations. 2. Ensure the view is customizable, allowing for easy modification of colors, sizes, and animation durations through parameters or modifiers. 3. Incorporate user interaction elements, such as buttons or gestures, that trigger or control the animations. 4. The view should be designed with accessibility in mind, ensuring that it is compatible with various screen sizes, orientations, and accessibility features like VoiceOver. 5. Consider implementing a state variable to manage the animation state (e.g., started, paused, completed) and use this state to conditionally apply animations or update the view's appearance. 6. Use SwiftUI's built-in animation APIs (e.g., `withAnimation`, `Animation`, `.animation`) to create smooth and performant animations. **Output Format**: The output should be a fully functional SwiftUI view written in Swift. The code should be well-structured, readable, and include comments to explain the purpose of each section or complex logic. The view should be encapsulated in a struct that conforms to the `View` protocol. **Examples**: - A simple example could be a button that scales up when pressed and returns to its original size when released. - A more complex example might involve a card view that flips over when tapped, revealing additional information on the back side, utilizing a rotation animation. - Another example could be a progress indicator that uses animations to simulate a loading process, with customizable colors and animation speeds.
This coding prompt is designed to help you get better results from AI assistants like ChatGPT, Claude, and Gemini. Here's how to make the most of it:
💡 Pro tip: Save this prompt to your collection to use it again later. Well-crafted prompts can save hours of back-and-forth with AI.
Adjust the prompt to match your specific industry, audience, or use case. Adding relevant context improves output quality.
Specify your desired output length (e.g., "in 200 words" or "in 3 bullet points") to get more targeted responses.
Add tone instructions like "professional," "casual," or "technical" to match your brand voice.
Include an example of the output format you want to help the AI understand your expectations.
Compatibility tags come from the prompt author. Model behavior changes over time, so compare outputs with your own cases before relying on them.
Learn more about using prompts effectively with our comprehensive guides: