Wednesday, June 22, 2022

SwiftUI Scrolling Finally Works on tvOS

Daniel Saidi:

One example where SwiftUI ended up costing me both time and money, was the first tvOS project that I did on my newly started company.

[…]

Scrolling with HStack, VStack (and in SwiftUI 2), LazyHStack, LazyVStack, LazyHGrid, LazyVGrid just didn’t work. The scrolling was lagging so badly that the whole project was in jeopardy.

[…]

I finally solved this by wrapping a UIKit UIScrollView in SwiftUI, which I describe in this article. It was not ideal, but did let me ship the app with minimal changes to the overall architecture. The app was well received by the users and later ported to iOS and iPadOS, where SwiftUI did deliver on its promise and let me create these new apps quickly, building on the same foundation as the tvOS app.

Apple have never mentioned these problems or recognized them in my bug reports, but I eventually got confirmation during last year’s WWDC labs, that the problem does originate from the framework, and not from my code.

Previously:

Comments RSS · Twitter

Leave a Comment