|
My app displays comments, and users can like these comments. The app uses a diffable data source, and when I click on the last row to like the comment, the collection view scrolls to the centre. Here is a video of the issue https://streamable.com/9vijyx (sorry about he music, my baby daughter was dancing) Here is some of my code that I think is relevant - you'll see by the comments that I have tried to fix this issue by storing the content offset but it feels VERY hacky. Any help would be greatly appreciated.
|
|
Hey there, I got your source code from upwork and the problem is with your PostDetail model. You should change
TO
And change the rest of you code accordingly. You should also remove updateSnapshot and just use applySnapshot Cheers. |
|
Another possibility would be to just update the cell directly and don't rely on snapshot for this simple change. Without snapshot, you could get reference to the cell from the collection view and set it to like state. |
SPONSORED Building and maintaining in-app subscription infrastructure is hard. Luckily there's a better way. With RevenueCat, you can implement subscriptions for your app in hours, not months, so you can get back to building your app.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.