Dear Experts,
I created a SwiftUI View (in a UIKit based project) whose objective is to display a short animation in the front of the user screen. I developed it 8 month ago in XCode 15 for iOS 17, no problems.
But since iOS 18, I can observe huge lags on my animation only in Release app. The problem is not present in Debug app.
I don't understand why this problem occurs, the animation is quite simple, it's just an offset deplacement.
I tried many thing like:
- Show the animation with a
UINavigationController
- Show the animation with a
UIWindow
- Move the view with
.position
- Remove the
GeometryReader
- All other animation
withAnimation
and.animation
Task
andDispatchQueue
- Etc...
I found that the laggy animation occurs when I set the Optimization Level
for the Swift Compiler - Code Generation
to Optimize for Speed [-O].
That's very strange because we had this option on Release for iOS 17 and we had no lags...
I can share to you a Sample Repository with the configuration we have. https://github.com/Thibma/sample-animation-swiftui
Today the only option I used is to develop this feature in UIKit but it's too bad to skip the SwiftUI opportunity. :/
If you have any ideas to resolve this, I take !
Thank you !