Reproduction can be found here
I'm making a chat view that's pretty similar to Messages.app
. A part of this is the bouncy messages made possible by UIKit Dynamics
. I have gotten my implementation working pretty well after consuming every bit of publicly available knowledge, but I have one remaining problem - I can't adjust the contentOffset
without everything going bad.
The chat requires adjusting scroll offset for features like maintaining the vertical scroll when adding more pages above, maintaining bottom offset when adding new messages, or scrolling to the bottom via button or a linked message programatically.
When I do any manual offset adjustment, issues start to arise. At best, some cells appear to swap attributes and become out of order. At worst, the dynamics go bananas and start displaying undefined behaviour, sometimes disappearing entirely.
I've tried everything I can think of, including returning normal flow layout attributes before/during offset adjustments, but this hasn't brought me to completion.
Here's a poorly downscaled gif diplaying an example of the issue - note how the messages containing 1-10 enumerated becomes out of order after using scrollToItem(at: lastIndexPath)
.
Has anyone managed to adjust offset programatically while using UIKit Dynamics? I'd love any pointers on how to proceed.