Conclusion
You should now have a basic understanding of animations and transitions in SwiftUI. This lesson focused on creating animations and transitions but not why and when to use them. A good starting point for UI-related questions on Apple platforms is the Human Interface Guidelines, here: https://developer.apple.com/design/human-interface-guidelines/.
The WWDC 2018 session “Designing Fluid Interfaces” also details gestures and motion in apps. You can view it at https://developer.apple.com/videos/play/wwdc2018/803.
Some guidelines to keep in mind:
- Animations can make a huge difference in an app if used wisely.
- Don’t use animations only for the sake of doing so. Have a purpose for each animation.
- Keep animation durations between 0.25 and 1.0 seconds. Shorter animations are often not noticeable. Longer animations risk annoying your user when they just want to get something done.
- Keep animations consistent in an app and with platform usage.
- Animations should be optional. Respect accessibility settings to reduce or eliminate application animations.
- Make sure animations are smooth and flow from one state to another.
By now, you can:
- Apply animations and transitions to enhance the user experience.
- Demonstrate the use of advanced animation techniques, such as spring-based animations and explicit animations.
In the next lesson, you’ll learn how to build a reusable view that can display other views.