diff --git a/FrameLayoutKit/Classes/ScrollStackView.swift b/FrameLayoutKit/Classes/ScrollStackView.swift index c58991f..caac79c 100644 --- a/FrameLayoutKit/Classes/ScrollStackView.swift +++ b/FrameLayoutKit/Classes/ScrollStackView.swift @@ -397,8 +397,8 @@ open class ScrollStackView: UIView { @discardableResult open func add(_ view: UIView?) -> FrameLayout { - if let view = view { scrollView.addSubview(view) } let layout = frameLayout.add(view) + if let view = view { scrollView.addSubview(view) } setNeedsLayout() return layout } @@ -410,8 +410,8 @@ open class ScrollStackView: UIView { @discardableResult open func insert(_ view: UIView?, at index: Int) -> FrameLayout { - if let view = view { scrollView.insertSubview(view, at: index) } let layout = frameLayout.insert(view, at: index) + if let view = view { scrollView.insertSubview(view, at: index) } setNeedsLayout() return layout } @@ -439,10 +439,11 @@ open class ScrollStackView: UIView { views = [] } - open func relayoutSubviews(animateDuration: TimeInterval = 0.35, options: UIView.AnimationOptions = .allowUserInteraction, completion: ((Bool) -> Void)? = nil) { + open func relayoutSubviews(animateDuration: TimeInterval = 0.35, options: UIView.AnimationOptions = .curveEaseInOut, completion: ((Bool) -> Void)? = nil) { setNeedsLayout() + UIView.animate(withDuration: animateDuration, delay: 0.0, options: options, animations: { - self.layoutSubviews() + self.layoutIfNeeded() }, completion: completion) } diff --git a/FrameLayoutKit/Classes/StackFrameLayout.swift b/FrameLayoutKit/Classes/StackFrameLayout.swift index 6fb48da..8a88e02 100644 --- a/FrameLayoutKit/Classes/StackFrameLayout.swift +++ b/FrameLayoutKit/Classes/StackFrameLayout.swift @@ -174,7 +174,7 @@ open class StackFrameLayout: FrameLayout { if let view = view, view.superview == nil { #if DEBUG if !isUserInteractionEnabled, view is UIControl { - print("[FrameLayoutKit] \(view) was automatically added to StackFrameLayout \(self) which was disabled user interation. This could make your control unable to interact. You can either set isUserInteractionEnabled = true for this FrameLayout or addSubview(your control) before adding to frameLayout") + print("⚠️ [FrameLayoutKit] \(view) was automatically added to StackFrameLayout \(self) which was disabled user interation. This could make your control unable to interact. You can either set isUserInteractionEnabled = true for this FrameLayout or addSubview(your control) before adding to frameLayout.") } #endif addSubview(view) @@ -200,7 +200,7 @@ open class StackFrameLayout: FrameLayout { if let view = view, view.superview == nil { #if DEBUG if !isUserInteractionEnabled, view is UIControl { - print("[FrameLayoutKit] \(view) was automatically added to StackFrameLayout \(self) which was disabled user interation. This could make your control unable to interact. You can either set isUserInteractionEnabled = true for this FrameLayout or addSubview(your control) before adding to frameLayout") + print("⚠️ [FrameLayoutKit] \(view) was automatically added to StackFrameLayout \(self) which was disabled user interation. This could make your control unable to interact. You can either set isUserInteractionEnabled = true for this FrameLayout or addSubview(your control) before adding to frameLayout.") } #endif addSubview(view)