diff --git a/CHANGELOG.md b/CHANGELOG.md index f5bb065..32a4870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,21 @@ All notable changes to this project will be documented in this file. #### 1.x Releases +- `1.4.x` Releases - [1.4.0](#140) - `1.3.x` Releases - [1.3.0](#130) - `1.2.x` Releases - [1.2.0](#120) - `1.1.x` Releases - [1.1.0](#110) - `1.0.x` Releases - [1.0.0](#100) +## [1.4.0](https://github.com/space-code/flex-ui/releases/tag/1.4.0) +Released on 2025-05-23. + +#### Added +- Update the `setImage(_:)` method signature. + - Added in Pull Request [#12](https://github.com/space-code/flex-ui/pull/12). +- Implement the `setContentHuggingPriority` & `setContentCompressionResistancePriority` methods. + - Added in Pull Request [#13](https://github.com/space-code/flex-ui/pull/13). + ## [1.3.0](https://github.com/space-code/flex-ui/releases/tag/1.3.0) Released on 2025-05-08. diff --git a/Sources/FlexUI/Classes/Extensions/FlexUI+UIButton.swift b/Sources/FlexUI/Classes/Extensions/FlexUI+UIButton.swift index b7ad54a..1a4dfb2 100644 --- a/Sources/FlexUI/Classes/Extensions/FlexUI+UIButton.swift +++ b/Sources/FlexUI/Classes/Extensions/FlexUI+UIButton.swift @@ -214,7 +214,7 @@ public extension FlexUI where Component: UIButton { /// - Returns: The current instance of `FlexUI` for further configuration. @discardableResult @MainActor - func setImage(_ image: UIImage, for controlState: UIControl.State = .normal) -> Self { + func setImage(_ image: UIImage?, for controlState: UIControl.State = .normal) -> Self { component.setImage(image, for: controlState) return self } diff --git a/Sources/FlexUI/Classes/Extensions/FlexUI+UIView.swift b/Sources/FlexUI/Classes/Extensions/FlexUI+UIView.swift index b5b4032..9780170 100644 --- a/Sources/FlexUI/Classes/Extensions/FlexUI+UIView.swift +++ b/Sources/FlexUI/Classes/Extensions/FlexUI+UIView.swift @@ -1,6 +1,6 @@ // // flex-ui -// Copyright © 2024 Space Code. All rights reserved. +// Copyright © 2025 Space Code. All rights reserved. // import UIKit @@ -140,4 +140,40 @@ public extension FlexUI where Component: UIView { component.alpha = alpha return self } + + /// Sets the content hugging priority for the specified axis. + /// Content hugging determines how likely the view is to shrink below its intrinsic content size. + /// A higher priority means the view resists growing beyond its content size. + /// + /// - Parameters: + /// - priority: The priority value to set. + /// - axis: The axis (`.horizontal` or `.vertical`) on which to apply the priority. + /// - Returns: The current instance, allowing method chaining. + @discardableResult + @MainActor + func setContentHuggingPriority( + _ priority: UILayoutPriority, + for axis: NSLayoutConstraint.Axis + ) -> Self { + component.setContentHuggingPriority(priority, for: axis) + return self + } + + /// Sets the content compression resistance priority for the specified axis. + /// Compression resistance determines how likely the view is to shrink below its intrinsic content size under compression. + /// A higher priority means the view resists being made smaller than its content size. + /// + /// - Parameters: + /// - priority: The priority value to set. + /// - axis: The axis (`.horizontal` or `.vertical`) on which to apply the priority. + /// - Returns: The current instance, allowing method chaining. + @discardableResult + @MainActor + func setContentCompressionResistancePriority( + _ priority: UILayoutPriority, + for axis: NSLayoutConstraint.Axis + ) -> Self { + component.setContentCompressionResistancePriority(priority, for: axis) + return self + } }