Skip to content

Commit

Permalink
Prevent isSkeletonActive to be called when isSkeletonable is false
Browse files Browse the repository at this point in the history
  • Loading branch information
William Salim committed Mar 11, 2020
1 parent 0d5c0a2 commit 8a2a512
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/SkeletonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ extension UIView {

@objc func skeletonTraitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
skeletonTraitCollectionDidChange(previousTraitCollection)
guard isSkeletonActive, let config = currentSkeletonConfig else { return }
guard isSkeletonable, isSkeletonActive, let config = currentSkeletonConfig else { return }
updateSkeleton(skeletonConfig: config)
}

Expand All @@ -113,7 +113,7 @@ extension UIView {
}

private func recursiveShowSkeleton(skeletonConfig config: SkeletonConfig, root: UIView? = nil) {
guard !isSkeletonActive && isSkeletonable else { return }
guard isSkeletonable && !isSkeletonActive else { return }
currentSkeletonConfig = config
swizzleLayoutSubviews()
swizzleTraitCollectionDidChange()
Expand Down

0 comments on commit 8a2a512

Please sign in to comment.