Cartography icon indicating copy to clipboard operation
Cartography copied to clipboard

Support array in `distribute`

Open joslinm opened this issue 9 years ago • 3 comments

You can't splat an array into var-args in Swift, which harms the utility of methods like constraint(views: [UIView], block: [Proxy] -> () There should be support for an array of views to distribute as well.

joslinm avatar Jan 22 '16 20:01 joslinm

Something like

public func distribute(by amount: CGFloat, horizontally array: [LayoutProxy]) -> [NSLayoutConstraint] {
    return reduce(array.first!, rest: Array(array.dropFirst())) { $0.trailing == $1.leading - amount }
}

?

jondewoo avatar May 26 '16 15:05 jondewoo

Yes

joslinm avatar May 30 '16 14:05 joslinm

Ups i missed this issue and i created a new one exactly with the same 😞 Don't know if you guys have a branch with this already, but i open a pull request with a suggestion to this

portellaa avatar Aug 01 '16 23:08 portellaa