From 0f8ab501921145f2e2768c6450857556b7216e24 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 16 Aug 2023 08:27:11 -0500 Subject: [PATCH] fixed layout issues Signed-off-by: Matt Bruce --- VDS/Components/Loader/Loader.swift | 9 ++++++++- VDS/Components/TitleLockup/TitleLockup.swift | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/VDS/Components/Loader/Loader.swift b/VDS/Components/Loader/Loader.swift index 9c67b6e2..dbaa1349 100644 --- a/VDS/Components/Loader/Loader.swift +++ b/VDS/Components/Loader/Loader.swift @@ -27,7 +27,14 @@ open class Loader: View { open var isActive: Bool = true { didSet { setNeedsUpdate() } } /// The Int used to determine the height and width of the Loader - open var size: Int = 40 { didSet { setNeedsUpdate() } } + open var size: Int = 40 { + didSet { + setNeedsUpdate(); + invalidateIntrinsicContentSize() + } + } + + open override var intrinsicContentSize: CGSize { .init(width: size, height: size) } //-------------------------------------------------- // MARK: - Lifecycle diff --git a/VDS/Components/TitleLockup/TitleLockup.swift b/VDS/Components/TitleLockup/TitleLockup.swift index bf3ea8f0..1b2b1af4 100644 --- a/VDS/Components/TitleLockup/TitleLockup.swift +++ b/VDS/Components/TitleLockup/TitleLockup.swift @@ -43,7 +43,7 @@ open class TitleLockup: View { private var stackView = UIStackView().with { $0.translatesAutoresizingMaskIntoConstraints = false $0.axis = .vertical - $0.distribution = .fill + $0.distribution = .fillProportionally } private var otherStandardStyle: OtherStandardStyle { @@ -311,7 +311,6 @@ open class TitleLockup: View { eyebrowLabel.attributes = eyebrowModel.textAttributes eyebrowLabel.numberOfLines = eyebrowModel.numberOfLines eyebrowLabel.surface = surface - //When uniform size is true if let titleModel, isUniformSize { if titleModel.isBold { @@ -329,6 +328,7 @@ open class TitleLockup: View { eyebrowLabel.textColorConfiguration = textColorPrimaryConfiguration eyebrowLabel.textStyle = eyebrowModel.isBold ? otherStandardStyle.value.bold : otherStandardStyle.value.regular } + eyebrowLabel.sizeToFit() } else { eyebrowLabel.reset() } @@ -341,6 +341,7 @@ open class TitleLockup: View { titleLabel.attributes = titleModel.textAttributes titleLabel.numberOfLines = titleModel.numberOfLines titleLabel.surface = surface + titleLabel.sizeToFit() } else { titleLabel.reset() } @@ -354,6 +355,7 @@ open class TitleLockup: View { subTitleLabel.attributes = subTitleModel.textAttributes subTitleLabel.numberOfLines = subTitleModel.numberOfLines subTitleLabel.surface = surface + subTitleLabel.sizeToFit() } else { subTitleLabel.reset() }