From 9fd63ec150adfbc7be3923af41f611055c79449b Mon Sep 17 00:00:00 2001 From: "N. Gomez" Date: Thu, 22 Feb 2024 12:45:57 +0100 Subject: [PATCH] FIX: layer layout animation at start (https://github.com/Juanpe/SkeletonView/issues/549) --- .../Internal/UIKitExtensions/UIView+SkeletonView.swift | 6 ++++-- .../Internal/UIKitExtensions/UIView+Transitions.swift | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+SkeletonView.swift b/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+SkeletonView.swift index f89f5f59..96946765 100644 --- a/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+SkeletonView.swift +++ b/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView+SkeletonView.swift @@ -105,7 +105,8 @@ private extension UIView { }) { subview in subview.recursiveShowSkeleton(skeletonConfig: config) } - + layoutSkeletonIfNeeded() + if let root = root { _flowDelegate?.didShowSkeletons(rootView: root) } @@ -126,7 +127,8 @@ 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..3dd14435 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()