Skip to content

Commit

Permalink
fix #383 UITableViewAlertForLayoutOutsideViewHierarchy warning (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhenry authored Apr 12, 2021
1 parent 6c4e909 commit 1bdb3b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/SubviewsSkeletonables.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ extension UIView {

extension UITableView {
override var subviewsToSkeleton: [UIView] {
visibleCells + visibleSectionHeaders + visibleSectionFooters
// on `UIViewController'S onViewDidLoad`, the window is still nil.
// Some developer trying to call `view.showAnimatedSkeleton()`
// when the request or data is loading which sometimes happens before the ViewDidAppear
guard window != nil else { return [] }
return visibleCells + visibleSectionHeaders + visibleSectionFooters
}
}

Expand Down

0 comments on commit 1bdb3b9

Please sign in to comment.