diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index c464d2b7..86ae34a3 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -447,33 +447,6 @@ open class TileContainerBase: View where //------------------------------------------------------------------------- //Overriding Nil Width Rules //------------------------------------------------------------------------- - //Rule 1: - //In the scenario where we only have a height but the multiplie is nil, we - //want to set the width with the parent's width which will more or less "fill" - //the container horizontally - //- height is set - //- width is not set - //- aspectRatio is not set - if let superviewWidth, superviewWidth > 0, - containerViewHeight != nil, - containerViewWidth == nil, - multiplier == nil { - containerViewWidth = superviewWidth - } - - //Rule 2: - //In the scenario where no width and height is set, want to set the width with the - //parent's width which will more or less "fill" the container horizontally - //- height is not set - //- width is not set - else if let superviewWidth, superviewWidth > 0, - containerViewWidth == nil, - containerViewHeight == nil { - containerViewWidth = superviewWidth - } - //------------------------------------------------------------------------- - - //------------------------------------------------------------------------- //Width + AspectRatio Constraint //------------------------------------------------------------------------- @@ -499,6 +472,14 @@ open class TileContainerBase: View where aspectRatioConstraint = widthAnchor.constraint(equalTo: heightAnchor, multiplier: multiplier) aspectRatioConstraint?.activate() + } + //------------------------------------------------------------------------- + //Multiplier, meaning it was pinned with width only Constraint + //------------------------------------------------------------------------- + else if let multiplier { + aspectRatioConstraint = heightAnchor.constraint(equalTo: widthAnchor, multiplier: multiplier) + aspectRatioConstraint?.activate() + } else { //------------------------------------------------------------------------- @@ -520,12 +501,6 @@ open class TileContainerBase: View where } } } - - /// This is the size of the superview's allowed space for this container first by constrained size which would include padding/inset values an - private var superviewWidth: CGFloat? { - horizontalPinnedWidth() ?? superview?.frame.size.width - } - } extension TileContainerBase {