From ddb4833eb1c862813b20517b0a9f660df410a80c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADnez=20Medina?= Date: Mon, 17 Jul 2023 11:12:09 +0200 Subject: [PATCH 1/2] fix(Bottom Sheet): Fix component to expand horizontally --- .../View/Fragments/List/Rows/InformativeRow.swift | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Sources/Mistica/Components/Sheet/View/Fragments/List/Rows/InformativeRow.swift b/Sources/Mistica/Components/Sheet/View/Fragments/List/Rows/InformativeRow.swift index fa05a84f..d24ae782 100644 --- a/Sources/Mistica/Components/Sheet/View/Fragments/List/Rows/InformativeRow.swift +++ b/Sources/Mistica/Components/Sheet/View/Fragments/List/Rows/InformativeRow.swift @@ -53,7 +53,7 @@ class InformativeRow: UIView { private let bottomContent: UIStackView = { let stackView = UIStackView() - stackView.spacing = 8 + stackView.isLayoutMarginsRelativeArrangement = true return stackView }() @@ -65,8 +65,6 @@ class InformativeRow: UIView { label.minHeight = 20 return label }() - - private lazy var dummyView = SpacerView(axis: .horizontal, amount: 1) } // MARK: Private @@ -84,13 +82,12 @@ private extension InformativeRow { bottomContent.isHidden = true } - dummyView.amount = item.icon.size.width + bottomContent.layoutMargins.left = item.icon.size.width + 8 } func layoutViews() { addSubview(withDefaultConstraints: centerSection) - bottomContent.addArrangedSubview(dummyView) bottomContent.addArrangedSubview(detailLabel) centerSection.addArrangedSubview(topContent) @@ -109,7 +106,7 @@ private class TopContentView: UIView { private var frontStackView: UIStackView = { let stackView = UIStackView() stackView.alignment = .center - stackView.spacing = 8 + stackView.isLayoutMarginsRelativeArrangement = true return stackView }() @@ -137,8 +134,6 @@ private class TopContentView: UIView { return label }() - private lazy var dummyView = SpacerView(axis: .horizontal, amount: 1) - var title: String? { didSet { dummyTitleLabel.text = title @@ -150,7 +145,7 @@ private class TopContentView: UIView { didSet { iconImageView.intrinsicHeight = icon.size.height iconImageView.intrinsicWidth = icon.size.width - dummyView.amount = icon.size.width + frontStackView.layoutMargins.left = icon.size.width + 8 load(icon: icon, in: iconImageView) @@ -179,7 +174,6 @@ private class TopContentView: UIView { backStackView.addArrangedSubview(iconImageView) backStackView.addArrangedSubview(dummyTitleLabel) - frontStackView.addArrangedSubview(dummyView) frontStackView.addArrangedSubview(titleLabel) } From 602c5251a988d80bfb0efad1154d70c308516d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADnez=20Medina?= Date: Wed, 19 Jul 2023 10:26:10 +0200 Subject: [PATCH 2/2] IOS-9113: Removed magic number --- .../Sheet/View/Fragments/List/Rows/InformativeRow.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sources/Mistica/Components/Sheet/View/Fragments/List/Rows/InformativeRow.swift b/Sources/Mistica/Components/Sheet/View/Fragments/List/Rows/InformativeRow.swift index d24ae782..9d524299 100644 --- a/Sources/Mistica/Components/Sheet/View/Fragments/List/Rows/InformativeRow.swift +++ b/Sources/Mistica/Components/Sheet/View/Fragments/List/Rows/InformativeRow.swift @@ -10,6 +10,10 @@ import UIKit // MARK: InformativeRow +private enum Constants: CGFloat { + case extraLeftMargin = 8 +} + class InformativeRow: UIView { struct Asset { let url: String @@ -82,7 +86,7 @@ private extension InformativeRow { bottomContent.isHidden = true } - bottomContent.layoutMargins.left = item.icon.size.width + 8 + bottomContent.layoutMargins.left = item.icon.size.width + Constants.extraLeftMargin.rawValue } func layoutViews() { @@ -145,7 +149,7 @@ private class TopContentView: UIView { didSet { iconImageView.intrinsicHeight = icon.size.height iconImageView.intrinsicWidth = icon.size.width - frontStackView.layoutMargins.left = icon.size.width + 8 + frontStackView.layoutMargins.left = icon.size.width + Constants.extraLeftMargin.rawValue load(icon: icon, in: iconImageView)