r/iOSProgramming • u/morenos-blend • Jul 03 '26
Question How to prevent UITableView content jumping while cell's content is resizing? In a hybrid UIKit/SwiftUI setup using UIHostingConfiguration
Hi all,
I'm trying to rewrite my big-ass SwiftUI scroll view by utilising UITableView and UIHostingConfiguration for displaying cells' content. The setup was easy but I've hit a roadblock related to resizing cells.
Every time cell's content grows vertically the table view jumps erratically, does anyone have any idea how to approach fixing this issue? For reference please see the video attached.
I've uploaded the sample project to GitHub:
https://github.com/wiencheck/SwiftUITableViewPOC
Main stuff is located in `TableViewPOC/TableViewController.swift`
View all comments
Show parent comment
13
u/andgordio Jul 03 '26
Maybe you’ll find a bit more context useful:
The jump you observe is caused by this:
You can force SwiftUI view to top-align within a growing vertical space by wrapping it in another view, reading new height through preference keys, and manually align the (now) child view to the top, but you’ll open a whole new can of bugs to work around with this kind of manipulation.