Skip to content

Commit 2d96c85

Browse files
Refactor map to single line (#351)
1 parent 0a36026 commit 2d96c85

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

Sources/Layout/UIKit/UIView+AutoLayout.swift

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,7 @@ extension UIView {
268268
multiplier: CGFloat = 1,
269269
constant: CGFloat = 0
270270
) -> [NSLayoutConstraint] {
271-
attributes.map { attribute in
272-
constraint(is: relation,
273-
toSuperview: attribute,
274-
multiplier: multiplier,
275-
constant: constant)
276-
}
271+
attributes.map { constraint(is: relation, toSuperview: $0, multiplier: multiplier, constant: constant) }
277272
}
278273

279274
/// Creates constraints defining the relationship between the given attributes of the receiver and target view.
@@ -293,13 +288,7 @@ extension UIView {
293288
multiplier: CGFloat = 1,
294289
constant: CGFloat = 0
295290
) -> [NSLayoutConstraint] {
296-
attributes.map { attribute in
297-
constraint(is: relation,
298-
to: attribute,
299-
of: targetView,
300-
multiplier: multiplier,
301-
constant: constant)
302-
}
291+
attributes.map { constraint(is: relation, to: $0, of: targetView, multiplier: multiplier, constant: constant) }
303292
}
304293

305294
// swiftlint:enable function_default_parameter_at_end

0 commit comments

Comments
 (0)