From 0027e29d84076e48862c492650a6d74abeb9a902 Mon Sep 17 00:00:00 2001 From: Mathew Stevenson Date: Sun, 4 Feb 2024 21:28:37 -0500 Subject: [PATCH] Try user suggestion https://github.com/Juanpe/SkeletonView/issues/549#issuecomment-1726059333 --- .../Sources/Internal/UIKitExtensions/UIView+SkeletonView.swift | 2 ++ .../Sources/Internal/UIKitExtensions/UIView+Transitions.swift | 2 ++ 2 files changed, 4 insertions(+) diff --git a/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+SkeletonView.swift b/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+SkeletonView.swift index f89f5f59..0d19ae61 100644 --- a/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+SkeletonView.swift +++ b/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+SkeletonView.swift @@ -105,6 +105,7 @@ private extension UIView { }) { subview in subview.recursiveShowSkeleton(skeletonConfig: config) } + layoutSkeletonIfNeeded() if let root = root { _flowDelegate?.didShowSkeletons(rootView: root) @@ -126,6 +127,7 @@ private extension UIView { }) { subview in subview.recursiveUpdateSkeleton(skeletonConfig: config) } + layoutSkeletonIfNeeded() if let root = root { _flowDelegate?.didUpdateSkeletons(rootView: root) diff --git a/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+Transitions.swift b/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+Transitions.swift index 66b3a610..a5a9c36d 100644 --- a/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+Transitions.swift +++ b/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+Transitions.swift @@ -5,6 +5,8 @@ import UIKit extension UIView { func startTransition(transitionBlock: @escaping () -> Void) { + layoutIfNeeded() + guard let transitionStyle = _currentSkeletonConfig?.transition, transitionStyle != .none else { transitionBlock()