Juanpe / SkeletonView

☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
MIT License
12.53k stars 1.1k forks source link

fix UITableViewAlertForLayoutOutsideViewHierarchy warning #384

Closed michaelhenry closed 3 years ago

michaelhenry commented 3 years ago

Summary

close #383

avoid having this warning

[TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window.

Juanpe commented 3 years ago

Hi @michaelhenry, thanks for your first contribution! 🎉

The looks fine, I only added a comment in order to provide more context about why this workaround 🙂

michaelhenry commented 3 years ago

I will add a comment about it. Thanks @Juanpe 🍻

Juanpe commented 3 years ago

Thanks again for your contribution, this PR will be included in the next version 🎉