From 3ccadd07b4e7fab1cabd3dfa243ccf35ec876146 Mon Sep 17 00:00:00 2001 From: Nikita Semenov Date: Tue, 4 Apr 2023 12:08:39 +0300 Subject: [PATCH] fix: remove tiuielements updates --- .../Sources/Helpers/SubviewConstraints.swift | 3 +-- .../Helpers/WrappedViewLayout+Helpers.swift | 3 +-- .../Views/StatefulButton/StatefulButton.swift | 19 ------------------- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/TIUIElements/Sources/Helpers/SubviewConstraints.swift b/TIUIElements/Sources/Helpers/SubviewConstraints.swift index 56f99181..02c03154 100644 --- a/TIUIElements/Sources/Helpers/SubviewConstraints.swift +++ b/TIUIElements/Sources/Helpers/SubviewConstraints.swift @@ -32,8 +32,7 @@ public struct SubviewConstraints { public var widthConstraint: NSLayoutConstraint? public var heightConstraint: NSLayoutConstraint? - // TODO: remove from release version - public init(centerXConstraint: NSLayoutConstraint? = nil, + init(centerXConstraint: NSLayoutConstraint? = nil, centerYConstraint: NSLayoutConstraint? = nil, leadingConstraint: NSLayoutConstraint? = nil, topConstraint: NSLayoutConstraint? = nil, diff --git a/TIUIElements/Sources/Views/Helpers/WrappedViewLayout+Helpers.swift b/TIUIElements/Sources/Views/Helpers/WrappedViewLayout+Helpers.swift index 7273d4db..e9881d1b 100644 --- a/TIUIElements/Sources/Views/Helpers/WrappedViewLayout+Helpers.swift +++ b/TIUIElements/Sources/Views/Helpers/WrappedViewLayout+Helpers.swift @@ -23,8 +23,7 @@ import TIUIKitCore import UIKit -// TODO: make internal on release -public extension WrappedViewLayout { +extension WrappedViewLayout { func setupSize(widthConstraint: NSLayoutConstraint?, heightConstraint: NSLayoutConstraint?) { diff --git a/TIUIElements/Sources/Views/StatefulButton/StatefulButton.swift b/TIUIElements/Sources/Views/StatefulButton/StatefulButton.swift index 5530f53c..2c3abe2d 100644 --- a/TIUIElements/Sources/Views/StatefulButton/StatefulButton.swift +++ b/TIUIElements/Sources/Views/StatefulButton/StatefulButton.swift @@ -70,7 +70,6 @@ open class StatefulButton: UIButton { public var additionalHitTestMargins: UIEdgeInsets = .zero public var onDisabledStateTapHandler: VoidClosure? - public var wrappedConstraints: SubviewConstraints? private var eventPropagations: StateEventPropagations = [:] @@ -223,26 +222,8 @@ open class StatefulButton: UIButton { private func updateAppearance(to state: State) { if let appearance = stateAppearance[state] { configureUIButton(appearance: appearance) - configureLayout(layout: appearance.layout) } else if state != .normal, let appearance = stateAppearance[.normal] { configureUIButton(appearance: appearance) - configureLayout(layout: appearance.layout) } } - - private func configureLayout(layout: UIView.DefaultWrappedLayout) { - guard let constraints = wrappedConstraints else { - return - } - - layout.setupSize(widthConstraint: constraints.widthConstraint, heightConstraint: constraints.heightConstraint) - - layout.setupCenterYOffset(centerYConstraint: constraints.centerYConstraint, - topConstraint: constraints.topConstraint, - bottomConstraint: constraints.bottomConstraint) - - layout.setupCenterXOffset(centerXConstraint: constraints.centerXConstraint, - leadingConstraint: constraints.leadingConstraint, - trailingConstraint: constraints.trailingConstraint) - } }