diff --git a/Example/FrameLayoutKit.xcworkspace/xcuserdata/namkennic.xcuserdatad/UserInterfaceState.xcuserstate b/Example/FrameLayoutKit.xcworkspace/xcuserdata/namkennic.xcuserdatad/UserInterfaceState.xcuserstate index ca80249..ec0f412 100644 Binary files a/Example/FrameLayoutKit.xcworkspace/xcuserdata/namkennic.xcuserdatad/UserInterfaceState.xcuserstate and b/Example/FrameLayoutKit.xcworkspace/xcuserdata/namkennic.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/FrameLayoutKit.podspec b/FrameLayoutKit.podspec index d38c69f..de54699 100644 --- a/FrameLayoutKit.podspec +++ b/FrameLayoutKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FrameLayoutKit' - s.version = '7.0.2' + s.version = '7.0.3' s.summary = 'FrameLayoutKit is a super fast and easy to use layout kit' s.description = <<-DESC FrameLayoutKit is a powerful Swift library designed to streamline the process of creating user interfaces. With its intuitive operator syntax and support for nested functions, developers can effortlessly construct complex UI layouts with minimal code. By leveraging the flexibility of operators, developers can easily position and arrange views within a container view, enabling precise control over the visual hierarchy. Additionally, the library offers a range of convenient functions for configuring view properties, such as setting dimensions, margins, and alignment. Whether you're building a simple screen or a complex interface, FrameLayoutKit simplifies the UI creation process, resulting in cleaner, more maintainable code. diff --git a/FrameLayoutKit/Classes/DoubleFrameLayout.swift b/FrameLayoutKit/Classes/DoubleFrameLayout.swift index 3dab39f..ebe35fa 100644 --- a/FrameLayoutKit/Classes/DoubleFrameLayout.swift +++ b/FrameLayoutKit/Classes/DoubleFrameLayout.swift @@ -323,6 +323,8 @@ open class DoubleFrameLayout: FrameLayout { } open override func sizeThatFits(_ size: CGSize, ignoreHiddenView: Bool) -> CGSize { + if !isEnabled { return .zero } + willSizeThatFitsBlock?(self, size) var result: CGSize = size @@ -619,6 +621,7 @@ open class DoubleFrameLayout: FrameLayout { override open func layoutSubviews() { super.layoutSubviews() + if !isEnabled { return } defer { didLayoutSubviewsBlock?(self) diff --git a/FrameLayoutKit/Classes/Extensions/ScrollStackView+Chainable.swift b/FrameLayoutKit/Classes/Extensions/ScrollStackView+Chainable.swift index 05f3952..9ebc2f5 100644 --- a/FrameLayoutKit/Classes/Extensions/ScrollStackView+Chainable.swift +++ b/FrameLayoutKit/Classes/Extensions/ScrollStackView+Chainable.swift @@ -180,6 +180,11 @@ extension ScrollStackView { return self } + @discardableResult public func enable(_ value: Bool) -> Self { + isEnabled = value + return self + } + @discardableResult public func willLayoutSubviews(_ block: @escaping (ScrollStackView) -> Void) -> Self { willLayoutSubviewsBlock = block return self diff --git a/FrameLayoutKit/Classes/FlowFrameLayout.swift b/FrameLayoutKit/Classes/FlowFrameLayout.swift index de5c98c..6335048 100644 --- a/FrameLayoutKit/Classes/FlowFrameLayout.swift +++ b/FrameLayoutKit/Classes/FlowFrameLayout.swift @@ -356,12 +356,15 @@ open class FlowFrameLayout: FrameLayout { } override open func sizeThatFits(_ size: CGSize) -> CGSize { + if !isEnabled { return .zero } + willSizeThatFitsBlock?(self, size) return calculateSize(fitSize: size).size.limitTo(minSize: minSize, maxSize: maxSize) } open override func layoutSubviews() { super.layoutSubviews() + if !isEnabled { return } defer { didLayoutSubviewsBlock?(self) diff --git a/FrameLayoutKit/Classes/GridFrameLayout.swift b/FrameLayoutKit/Classes/GridFrameLayout.swift index 50bc74d..0c8da93 100644 --- a/FrameLayoutKit/Classes/GridFrameLayout.swift +++ b/FrameLayoutKit/Classes/GridFrameLayout.swift @@ -494,6 +494,7 @@ open class GridFrameLayout: FrameLayout { fileprivate var lastSize: CGSize = .zero open override func layoutSubviews() { super.layoutSubviews() + if !isEnabled { return } if maxColumnWidth > 0, lastSize != bounds.size { lastSize = bounds.size @@ -506,6 +507,7 @@ open class GridFrameLayout: FrameLayout { } open override func sizeThatFits(_ size: CGSize) -> CGSize { + if !isEnabled { return .zero } return stackLayout.sizeThatFits(size) } diff --git a/FrameLayoutKit/Classes/ScrollStackView.swift b/FrameLayoutKit/Classes/ScrollStackView.swift index ca2f2c1..d806ca2 100644 --- a/FrameLayoutKit/Classes/ScrollStackView.swift +++ b/FrameLayoutKit/Classes/ScrollStackView.swift @@ -307,6 +307,8 @@ open class ScrollStackView: UIView { } } + public var isEnabled = true + public var heightRatio: CGFloat { get { frameLayout.heightRatio } set { @@ -428,11 +430,14 @@ open class ScrollStackView: UIView { } override open func sizeThatFits(_ size: CGSize) -> CGSize { + if !isEnabled { return .zero } willSizeThatFitsBlock?(self, size) return frameLayout.sizeThatFits(size) } override open func layoutSubviews() { + if !isEnabled { return } + willLayoutSubviewsBlock?(self) super.layoutSubviews() diff --git a/FrameLayoutKit/Classes/StackFrameLayout.swift b/FrameLayoutKit/Classes/StackFrameLayout.swift index f422b6a..9a47b7e 100644 --- a/FrameLayoutKit/Classes/StackFrameLayout.swift +++ b/FrameLayoutKit/Classes/StackFrameLayout.swift @@ -389,6 +389,7 @@ open class StackFrameLayout: FrameLayout { // MARK: - open override func sizeThatFits(_ size: CGSize, ignoreHiddenView: Bool) -> CGSize { + if !isEnabled { return .zero } willSizeThatFitsBlock?(self, size) var result: CGSize = size @@ -579,6 +580,7 @@ open class StackFrameLayout: FrameLayout { override open func layoutSubviews() { super.layoutSubviews() + if !isEnabled { return } defer { didLayoutSubviewsBlock?(self)