Cartography icon indicating copy to clipboard operation
Cartography copied to clipboard

Make reduce public

Open paulrolfe opened this issue 9 years ago • 0 comments

I'd like to propose making the reduce function in Distribute from private to public.

The reason is that I'd like to add some extensions in my project for distribute. For example, if I wanted to add this global function, I would need access.

public func distributeEvenly(by amount: CGFloat, horizontally all: [LayoutProxy]) -> [NSLayoutConstraint] {
    var rest = all
    rest.removeAtIndex(rest.startIndex)
    let first = all.first!
    let spacing = reduce(first, rest: rest) { $0.trailing == $1.leading - amount }
    let even = reduce(first, rest: rest) { $0.width == $1.width }
    return spacing + even
}

paulrolfe avatar Jan 15 '16 14:01 paulrolfe