GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

Animation (Transition) applies to all elements in ForEach instead of one. Different animation behavior on preview and device

Forums > SwiftUI

The problem is with the elements’ animation inside of ForEach. It works well in preview - when I add or delete items each individual animates separately. BUT when I run it on simulator or my device animation is applied to the whole list of elements. I have no idea why… Interesting thing is that the list of selected exercises is okay always, but the list of exercises available to pick is broken.

I made a notion page with more information and videos of problem. Would be really greatful if you help me with fixing it. Thank you very much!

https:// DELETE SPACE emphasized-prose-caf.notion DELETE SPACE .site/Problem-code-50cde42166414591bb97e9b6091944bb?pvs=4

2      

I've encountered similar challenges in the past, and troubleshooting can indeed be tricky.

To assist you better, I recommend checking the following:

  1. Verify that your Xcode and SwiftUI versions are up to date, as outdated versions can sometimes lead to unexpected behavior.
  2. Double-check the animation code within the ForEach loop to ensure it's correctly configured for individual elements.
  3. Review the Notion page you provided for more insights. It's a helpful resource for understanding the problem.

I've faced my share of coding puzzles, much like navigating through the intricacies of uaesafari. If the issue persists, consider seeking advice from relevant forums or communities where developers share their experiences.

2      

Hacking with Swift is sponsored by Alex.

SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!

Try for free!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.