From 33a311cef88534dfe33cd9332e7f2a47804540f6 Mon Sep 17 00:00:00 2001 From: Mikhail Date: Fri, 5 Jun 2026 19:14:42 +0300 Subject: [PATCH] remove deprecations --- .../Avatar/Models/AvatarImageSource.swift | 6 ---- .../Avatar/Models/AvatarPlaceholder.swift | 12 -------- .../Components/Button/Models/ButtonVM.swift | 29 ++----------------- .../Components/Button/SUButton.swift | 2 +- .../Components/Button/UKButton.swift | 2 +- .../CircularProgress/SUCircularProgress.swift | 13 --------- .../CircularProgress/UKCircularProgress.swift | 18 ------------ .../ProgressBar/SUProgressBar.swift | 13 --------- .../ProgressBar/UKProgressBar.swift | 18 ------------ 9 files changed, 4 insertions(+), 109 deletions(-) diff --git a/Sources/ComponentsKit/Components/Avatar/Models/AvatarImageSource.swift b/Sources/ComponentsKit/Components/Avatar/Models/AvatarImageSource.swift index 81fcc20d..80e0697a 100644 --- a/Sources/ComponentsKit/Components/Avatar/Models/AvatarImageSource.swift +++ b/Sources/ComponentsKit/Components/Avatar/Models/AvatarImageSource.swift @@ -13,11 +13,5 @@ extension AvatarVM { /// /// - Parameter image: See ``UniversalImage``. case local(_ image: UniversalImage) - - /// An image loaded from a local asset. - @available(*, deprecated, message: "Use `local(_:)` instead.") - public static func local(_ name: String, _ bundle: Bundle? = nil) -> Self { - return .local(.init(name, bundle: bundle)) - } } } diff --git a/Sources/ComponentsKit/Components/Avatar/Models/AvatarPlaceholder.swift b/Sources/ComponentsKit/Components/Avatar/Models/AvatarPlaceholder.swift index b1b05975..9ddb89c2 100644 --- a/Sources/ComponentsKit/Components/Avatar/Models/AvatarPlaceholder.swift +++ b/Sources/ComponentsKit/Components/Avatar/Models/AvatarPlaceholder.swift @@ -17,17 +17,5 @@ extension AvatarVM { /// /// - Parameter image: See ``UniversalImage``. case image(_ image: UniversalImage) - - /// A placeholder that displays an SF Symbol. - @available(*, deprecated, message: "Use `image(_:)` instead.") - public static func sfSymbol(_ name: String) -> Self { - return .image(.init(systemName: name)) - } - - /// A placeholder that displays a custom icon from an asset catalog. - @available(*, deprecated, message: "Use `image(_:)` instead.") - public static func icon(_ name: String, _ bundle: Bundle? = nil) -> Self { - return .image(.init(name, bundle: bundle)) - } } } diff --git a/Sources/ComponentsKit/Components/Button/Models/ButtonVM.swift b/Sources/ComponentsKit/Components/Button/Models/ButtonVM.swift index fc90691e..15e644fb 100644 --- a/Sources/ComponentsKit/Components/Button/Models/ButtonVM.swift +++ b/Sources/ComponentsKit/Components/Button/Models/ButtonVM.swift @@ -38,14 +38,6 @@ public struct ButtonVM: ComponentVM { /// Defaults to `.leading`. public var imageLocation: ImageLocation = .leading - /// Defines how image is rendered. - @available(*, deprecated, message: "Use `image.withRenderingMode(_:)` instead.") - public var imageRenderingMode: ImageRenderingMode? - - /// The source of the image to be displayed. - @available(*, deprecated, message: "Use `image` instead.") - public var imageSrc: ImageSource? - /// A Boolean value indicating whether the button is enabled or disabled. /// /// Defaults to `true`. @@ -200,30 +192,13 @@ extension ButtonVM { } } } - var imageWithLegacyFallback: UniversalImage? { - if let image { return image } - - guard let imageSrc else { return nil } - - let image = switch imageSrc { - case .sfSymbol(let name): - UniversalImage(systemName: name) - case .local(let name, let bundle): - UniversalImage(name, bundle: bundle) - } - if let imageRenderingMode { - return image.withRenderingMode(imageRenderingMode) - } else { - return image - } - } } // MARK: UIKit Helpers extension ButtonVM { var isImageHidden: Bool { - return self.isLoading || self.imageWithLegacyFallback.isNil + return self.isLoading || self.image.isNil } func preferredSize( for contentSize: CGSize, @@ -256,7 +231,7 @@ extension ButtonVM { || self.font != oldModel.font || self.isFullWidth != oldModel.isFullWidth || self.isLoading != oldModel.isLoading - || self.imageWithLegacyFallback != oldModel.imageWithLegacyFallback + || self.image != oldModel.image || self.contentSpacing != oldModel.contentSpacing || self.title != oldModel.title || self.style != oldModel.style diff --git a/Sources/ComponentsKit/Components/Button/SUButton.swift b/Sources/ComponentsKit/Components/Button/SUButton.swift index 76f331af..959fe573 100644 --- a/Sources/ComponentsKit/Components/Button/SUButton.swift +++ b/Sources/ComponentsKit/Components/Button/SUButton.swift @@ -63,7 +63,7 @@ public struct SUButton: View { @ViewBuilder private var content: some View { - switch (self.model.isLoading, self.model.imageWithLegacyFallback, self.model.imageLocation) { + switch (self.model.isLoading, self.model.image, self.model.imageLocation) { case (true, _, _) where self.model.title.isEmpty: SULoading(model: self.model.preferredLoadingVM) case (true, _, _): diff --git a/Sources/ComponentsKit/Components/Button/UKButton.swift b/Sources/ComponentsKit/Components/Button/UKButton.swift index b730db11..7a216f5d 100644 --- a/Sources/ComponentsKit/Components/Button/UKButton.swift +++ b/Sources/ComponentsKit/Components/Button/UKButton.swift @@ -292,7 +292,7 @@ extension UKButton { view.isVisible = model.isLoading } static func imageView(_ imageView: UIImageView, model: Model) { - imageView.image = model.imageWithLegacyFallback?.uiImage + imageView.image = model.image?.uiImage imageView.contentMode = .scaleAspectFit imageView.isHidden = model.isImageHidden imageView.tintColor = model.foregroundColor.uiColor diff --git a/Sources/ComponentsKit/Components/CircularProgress/SUCircularProgress.swift b/Sources/ComponentsKit/Components/CircularProgress/SUCircularProgress.swift index dee6ad47..357c3983 100644 --- a/Sources/ComponentsKit/Components/CircularProgress/SUCircularProgress.swift +++ b/Sources/ComponentsKit/Components/CircularProgress/SUCircularProgress.swift @@ -16,19 +16,6 @@ public struct SUCircularProgress: View { // MARK: - Initializer - /// Initializer. - /// - Parameters: - /// - currentValue: Current progress. - /// - model: A model that defines the appearance properties. - @available(*, deprecated, message: "Set `currentValue` in the model instead.") - public init( - currentValue: CGFloat = 0, - model: CircularProgressVM = .init() - ) { - self.currentValue = currentValue - self.model = model - } - /// Initializer. /// - Parameters: /// - model: A model that defines the appearance properties. diff --git a/Sources/ComponentsKit/Components/CircularProgress/UKCircularProgress.swift b/Sources/ComponentsKit/Components/CircularProgress/UKCircularProgress.swift index c1777454..dce73525 100644 --- a/Sources/ComponentsKit/Components/CircularProgress/UKCircularProgress.swift +++ b/Sources/ComponentsKit/Components/CircularProgress/UKCircularProgress.swift @@ -42,24 +42,6 @@ open class UKCircularProgress: UIView, UKComponent { // MARK: - Initialization - /// Initializer. - /// - Parameters: - /// - initialValue: The initial progress value. Defaults to `0`. - /// - model: The model that defines the appearance properties. - @available(*, deprecated, message: "Set `currentValue` in the model instead.") - public init( - initialValue: CGFloat = 0, - model: CircularProgressVM = .init() - ) { - self.model = model - self.currentValue = initialValue - super.init(frame: .zero) - - self.setup() - self.style() - self.layout() - } - /// Initializer. /// - Parameters: /// - model: The model that defines the appearance properties. diff --git a/Sources/ComponentsKit/Components/ProgressBar/SUProgressBar.swift b/Sources/ComponentsKit/Components/ProgressBar/SUProgressBar.swift index 96a1e0cc..8c8e790d 100644 --- a/Sources/ComponentsKit/Components/ProgressBar/SUProgressBar.swift +++ b/Sources/ComponentsKit/Components/ProgressBar/SUProgressBar.swift @@ -15,19 +15,6 @@ public struct SUProgressBar: View { // MARK: - Initializer - /// Initializer. - /// - Parameters: - /// - currentValue: The current progress value. - /// - model: A model that defines the appearance properties. - @available(*, deprecated, message: "Set `currentValue` in the model instead.") - public init( - currentValue: CGFloat, - model: ProgressBarVM = .init() - ) { - self.currentValue = currentValue - self.model = model - } - /// Initializer. /// - Parameters: /// - model: A model that defines the appearance properties. diff --git a/Sources/ComponentsKit/Components/ProgressBar/UKProgressBar.swift b/Sources/ComponentsKit/Components/ProgressBar/UKProgressBar.swift index 1583645b..a275336d 100644 --- a/Sources/ComponentsKit/Components/ProgressBar/UKProgressBar.swift +++ b/Sources/ComponentsKit/Components/ProgressBar/UKProgressBar.swift @@ -50,24 +50,6 @@ open class UKProgressBar: FullWidthComponent, UKComponent { // MARK: - Initialization - /// Initializer. - /// - Parameters: - /// - initialValue: The initial progress value. Defaults to `0`. - /// - model: A model that defines the appearance properties. - @available(*, deprecated, message: "Set `currentValue` in the model instead.") - public init( - initialValue: CGFloat = 0, - model: ProgressBarVM = .init() - ) { - self.currentValue = initialValue - self.model = model - super.init(frame: .zero) - - self.setup() - self.style() - self.layout() - } - /// Initializer. /// - Parameters: /// - model: A model that defines the appearance properties.