Issues with Custom View Animations in macOS 13.6 Causing Lag and Incomplete Render
I'm having trouble with I'm experiencing performance issues with custom view animations in my macOS app running on 13.6..... The animations, which are supposed to smoothly transition a view in and out, sometimes lag significantly or appear incomplete. I've implemented the animations using Core Animation but noticed that they are not as responsive as I expected. Specifically, when I try to animate a view's alpha and position simultaneously, the animation stutters and the view doesnโt always return to its original state after the animation completes. Hereโs an example of my implementation: ```swift let fadeInAnimation = CABasicAnimation(keyPath: "opacity") fadeInAnimation.fromValue = 0.0 fadeInAnimation.toValue = 1.0 fadeInAnimation.duration = 0.5 let moveAnimation = CABasicAnimation(keyPath: "position") moveAnimation.fromValue = CGPoint(x: view.center.x, y: view.center.y + 100) moveAnimation.toValue = view.center moveAnimation.duration = 0.5 let groupAnimation = CAAnimationGroup() groupAnimation.animations = [fadeInAnimation, moveAnimation] groupAnimation.duration = 0.5 view.layer.add(groupAnimation, forKey: "fadeInAndMove") ``` I've tried setting the `view.layer.shouldRasterize = true` to improve performance, but it doesn't seem to help much. Additionally, I've ensured that I call `view.layoutIfNeeded()` before starting the animations to ensure the layout is updated. The unexpected behavior I encounter is that sometimes the view freezes for a brief moment, and the animations feel sluggish, especially when run on older hardware. Has anyone else encountered similar issues with animations in macOS 13.6? Any suggestions on how to improve the performance or ensure the animations run smoothly? For context: I'm using Swift on Windows 11. Thanks for your help in advance! This is happening in both development and production on macOS. What would be the recommended way to handle this?