From b0dd4269a3c1e4b8c9b429d5d5180a3c02a58ce9 Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Fri, 23 Feb 2024 08:18:11 -0800 Subject: [PATCH] `LayoutItem` code cleanup (two methods) (#348) --- Sources/Layout/LayoutItem.swift | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Sources/Layout/LayoutItem.swift b/Sources/Layout/LayoutItem.swift index 9c87c1fc..26db71b7 100644 --- a/Sources/Layout/LayoutItem.swift +++ b/Sources/Layout/LayoutItem.swift @@ -256,8 +256,8 @@ extension LayoutItem { priority: UILayoutPriority = .required ) -> LayoutItem { addingSuperviewConstraints { layoutItem in - layoutItem.layoutItemView.width - .constraint(equalTo: layoutItem.layoutItemView.height, multiplier: ratio) + layoutItem.layoutItemView + .constraint(for: .width, to: .height, of: layoutItem.layoutItemView, multiplier: ratio) .withPriority(priority) } } @@ -460,9 +460,10 @@ extension LayoutItem { ) -> LayoutItem { addingSuperviewConstraints { layoutItem in for attribute: NSLayoutConstraint.Attribute in attributes { - layoutItem - .layoutItemView - .constraint(for: attribute.canonicalAttribute, toSuperview: attribute, constant: constant) + layoutItem.layoutItemView + .constraint(for: attribute.canonicalAttribute, + toSuperview: attribute, + constant: constant) .withPriority(priority) } }