From 4ccebe8e8bb1fc3d54cb9168d14e5d09ab49b200 Mon Sep 17 00:00:00 2001 From: Nikita Semenov Date: Fri, 17 Mar 2023 11:46:44 +0300 Subject: [PATCH] fix: code review notes --- .../Placeholder/Views/BasePlaceholderView.swift | 16 ++++++++-------- .../Views/DefaultPlaceholderView.swift | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/TIUIElements/Sources/Views/Placeholder/Views/BasePlaceholderView.swift b/TIUIElements/Sources/Views/Placeholder/Views/BasePlaceholderView.swift index 25cecf3b..55663664 100644 --- a/TIUIElements/Sources/Views/Placeholder/Views/BasePlaceholderView.swift +++ b/TIUIElements/Sources/Views/Placeholder/Views/BasePlaceholderView.swift @@ -175,6 +175,14 @@ open class BasePlaceholderView: BaseInitializableView { controlsStackView.configureUIView(appearance: appearance.controlsViewAppearance) } + open func configureLayoutForKeyboard(_ notification: Notification, isKeyboardHidden: Bool) { + let multiplier = isKeyboardHidden ? 1.0 : -1.0 + + if let height = getKeyboardHeight(notification) { + controlsViewConstraints?.bottomConstraint?.constant = multiplier * height / 2 + } + } + // MARK: - Private methods private func configureImageViewLayout(layout: WrappedViewLayout) { @@ -224,14 +232,6 @@ open class BasePlaceholderView: BaseInitializableView { trailingConstraint: constraints.trailingConstraint) } - private func configureLayoutForKeyboard(_ notification: Notification, isKeyboardHidden: Bool) { - let multiplier = isKeyboardHidden ? 1.0 : -1.0 - - if let height = getKeyboardHeight(notification) { - controlsViewConstraints?.bottomConstraint?.constant = multiplier * height / 2 - } - } - private func getKeyboardHeight(_ notification: Notification) -> CGFloat? { guard let userInfo = notification.userInfo else { return nil diff --git a/TIUIElements/Sources/Views/Placeholder/Views/DefaultPlaceholderView.swift b/TIUIElements/Sources/Views/Placeholder/Views/DefaultPlaceholderView.swift index 4c41aa46..de9761ad 100644 --- a/TIUIElements/Sources/Views/Placeholder/Views/DefaultPlaceholderView.swift +++ b/TIUIElements/Sources/Views/Placeholder/Views/DefaultPlaceholderView.swift @@ -51,7 +51,7 @@ public final class DefaultPlaceholderView: BasePlaceholderView, App } if size.height.isFinite, size.height > .zero { - imageViewConstraints?.widthConstraint?.constant = size.height + imageViewConstraints?.heightConstraint?.constant = size.height } if size.width.isFinite, size.width > .zero {