From 2d96c850c01a5f661a0982d0f41056d79b4428f1 Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Fri, 23 Feb 2024 08:23:35 -0800 Subject: [PATCH] Refactor map to single line (#351) --- 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 ba920eb2..18eb62bd 100644 --- a/Sources/Layout/UIKit/UIView+AutoLayout.swift +++ b/Sources/Layout/UIKit/UIView+AutoLayout.swift @@ -268,12 +268,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. @@ -293,13 +288,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