技巧

SwiftUI App 卡顿原因:未使用 Core Animation

SwiftUI App 卡顿一个原因是它没有用 Core Animation

精选理由

朋友,SwiftUI App 卡顿可能是因为没用 Core Animation,这个技术能让动画更流畅,你试试看。

SwiftUI App 可能卡顿是因为它没有使用 Core Animation。SwiftUI 动画在应用内运行,而 Core Animation 在渲染服务器上运行。这会阻塞主线程,导致 SwiftUI 球体停滞,而 UIKit 的动画则保持移动。

原文 · 宝玉

SwiftUI App 卡顿一个原因是它没有用 Core Animation

SwiftUI App 卡顿一个原因是它没有用 Core Animation Krzysztof Magiera @kzzzf SwiftUI isn’t native and here’s why SwiftUI apps may sometimes feel janky. It ditches the key element that made animations run so smoothly on iOS since the original iPhone: Core Animation. In SwiftUI animations run in-app without CA backing. Block the main thread: SwiftUI ball stalls while UIKit’s keeps moving on the render server. Your browser does not support the video tag. 🔗 View on Twitter 🔗 View Quoted Tweet 💬 0 🔄 0 ❤️ 1 👀 3161 📊 1 ⚡