Cartography
Cartography copied to clipboard
Make reduce public
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
}