From 64211901b64ca17c0f0f3db5e2ea33607bb5802c Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Tue, 20 Feb 2024 21:45:38 -0800 Subject: [PATCH] Refactor map to single line --- Sources/Layout/UIKit/UIView+AutoLayout.swift | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/Sources/Layout/UIKit/UIView+AutoLayout.swift b/Sources/Layout/UIKit/UIView+AutoLayout.swift index b102efb0..2f698d1a 100644 --- a/Sources/Layout/UIKit/UIView+AutoLayout.swift +++ b/Sources/Layout/UIKit/UIView+AutoLayout.swift @@ -266,12 +266,7 @@ extension UIView { multiplier: CGFloat = 1, constant: CGFloat = 0 ) -> [NSLayoutConstraint] { - attributes.map { attribute in - constraint(is: relation, - toSuperview: attribute, - multiplier: multiplier, - constant: constant) - } + attributes.map { constraint(is: relation, toSuperview: $0, multiplier: multiplier, constant: constant) } } /// Creates constraints defining the relationship between the given attributes of the receiver and target view. @@ -291,13 +286,7 @@ extension UIView { multiplier: CGFloat = 1, constant: CGFloat = 0 ) -> [NSLayoutConstraint] { - attributes.map { attribute in - constraint(is: relation, - to: attribute, - of: targetView, - multiplier: multiplier, - constant: constant) - } + attributes.map { constraint(is: relation, to: $0, of: targetView, multiplier: multiplier, constant: constant) } } // swiftlint:enable function_default_parameter_at_end