How do I update cell height after image downloaded from server using Kingfisher setImage with completion handler method? After the image downloads, I resize its height constraint using this: cell.imageHeight.constant = image.size.height * cell.frame.size.width / image.size.width.
The image is downloaded and set on cellForRow method, but I tried also in willDisplayCell, same problems. I also check cell.tag == indexPath.row in completion handler of setImage method.
I've already tried the following methods and none worked:
heightForRowisUITableViewAutomaticDimensionandestimatedHeightForRowAtis some value (biggest possible cell) and all other combinations of these 2- tableview begin/end updates
reloadRowsat indexPathcell.setNeedsLayout,layoutIfNeededorlayoutSubviewsdispatch main async
Either of them come to the same issues: jumpy table on scrolling, cell height wrong on first display and to update it I have to scroll up and down to hide and show that cell, wrong height calculated by the tableview on some cells.
If i scroll back to top, everything is alright because all images are already in cache.
How does everybody do this? How does facebook or instagram do this? How to update cell height after you get it from any API?