From 6775c51095ceadafed5a6975c32ce0c78b3bb5c7 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Sat, 5 Apr 2025 20:17:18 +0400 Subject: [PATCH 1/3] Implement setting an optional value as the UILabel's text (#8) * Implement setting an optional value as the UILabel's text * Implement setting an optional value as the UITextField's placeholder * Update `CHANGELOG.md` --- CHANGELOG.md | 6 ++++++ Sources/FlexUI/Classes/Extensions/FlexUI+UILabel.swift | 4 ++-- Sources/FlexUI/Classes/Extensions/FlexUI+UITextField.swift | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5471181..bcc0ea3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to this project will be documented in this file. +## [Unreleased] + +#### Added +- Implement setting an optional value as the UILabel's text. + - Added in Pull Request [#8](https://github.com/space-code/flex-ui/pull/8). + #### 1.x Releases - `1.2.x` Releases - [1.2.0](#120) - `1.1.x` Releases - [1.1.0](#110) diff --git a/Sources/FlexUI/Classes/Extensions/FlexUI+UILabel.swift b/Sources/FlexUI/Classes/Extensions/FlexUI+UILabel.swift index cb26eb4..e95abf8 100644 --- a/Sources/FlexUI/Classes/Extensions/FlexUI+UILabel.swift +++ b/Sources/FlexUI/Classes/Extensions/FlexUI+UILabel.swift @@ -1,6 +1,6 @@ // // flex-ui -// Copyright © 2024 Space Code. All rights reserved. +// Copyright © 2025 Space Code. All rights reserved. // import UIKit @@ -12,7 +12,7 @@ public extension FlexUI where Component: UILabel { /// - Returns: The current instance of `FlexUI` for further configuration. @discardableResult @MainActor - func text(_ text: String) -> Self { + func text(_ text: String?) -> Self { component.text = text return self } diff --git a/Sources/FlexUI/Classes/Extensions/FlexUI+UITextField.swift b/Sources/FlexUI/Classes/Extensions/FlexUI+UITextField.swift index 8e31f27..d5c35b1 100644 --- a/Sources/FlexUI/Classes/Extensions/FlexUI+UITextField.swift +++ b/Sources/FlexUI/Classes/Extensions/FlexUI+UITextField.swift @@ -23,7 +23,7 @@ public extension FlexUI where Component: UITextField { /// - Returns: The current instance of `FlexUI` for further configuration. @discardableResult @MainActor - func placeholder(_ placeholder: String) -> Self { + func placeholder(_ placeholder: String?) -> Self { component.placeholder = placeholder return self } From 7fbc85dda5c1c1ac5727b97bafc70bce9c48157f Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Thu, 8 May 2025 17:29:48 +0500 Subject: [PATCH 2/3] Implement a new `setImage` method for the `UIButton` class (#9) * Implement a new `setImage` method for the `UIButton` class * Update `CHANGELOG.md` --- CHANGELOG.md | 2 ++ .../FlexUI/Classes/Extensions/FlexUI+UIButton.swift | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcc0ea3..adb52e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). diff --git a/Sources/FlexUI/Classes/Extensions/FlexUI+UIButton.swift b/Sources/FlexUI/Classes/Extensions/FlexUI+UIButton.swift index 103443b..b7ad54a 100644 --- a/Sources/FlexUI/Classes/Extensions/FlexUI+UIButton.swift +++ b/Sources/FlexUI/Classes/Extensions/FlexUI+UIButton.swift @@ -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 + } } From 1221f2359ecb94f2a47dcb2b1596fc3e223948cf Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Thu, 8 May 2025 17:32:06 +0500 Subject: [PATCH 3/3] Update `CHANGELOG.md` (#10) --- CHANGELOG.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index adb52e5..f5bb065 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,14 @@ # Change Log All notable changes to this project will be documented in this file. -## [Unreleased] +#### 1.x Releases +- `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.3.0](https://github.com/space-code/flex-ui/releases/tag/1.3.0) +Released on 2025-05-08. #### Added - Implement a new `setImage` method for the `UIButton` class. @@ -9,11 +16,6 @@ All notable changes to this project will be documented in this file. - Implement setting an optional value as the UILabel's text. - Added in Pull Request [#8](https://github.com/space-code/flex-ui/pull/8). -#### 1.x Releases -- `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.2.0](https://github.com/space-code/flex-ui/releases/tag/1.2.0) Released on 2025-02-15.