Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
## [Unreleased]

#### Added
- Implement a new `setImage` method for the `UIButton` class.
- Added in Pull Request [#9](https://github.com/space-code/flex-ui/pull/9).
- Implement setting an optional value as the UILabel's text.
- Added in Pull Request [#8](https://github.com/space-code/flex-ui/pull/8).

Expand Down
13 changes: 13 additions & 0 deletions Sources/FlexUI/Classes/Extensions/FlexUI+UIButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,17 @@ public extension FlexUI where Component: UIButton {
component.isEnabled = isEnable
return self
}

/// Sets the image for a specific button state.
///
/// - Parameters:
/// - image: The image to set.
/// - controlState: The state for which to set the background image (default is `.normal`).
/// - Returns: The current instance of `FlexUI` for further configuration.
@discardableResult
@MainActor
func setImage(_ image: UIImage, for controlState: UIControl.State = .normal) -> Self {
component.setImage(image, for: controlState)
return self
}
}