Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make reduce public #191

Open
paulrolfe opened this issue Jan 15, 2016 · 0 comments
Open

Make reduce public #191

paulrolfe opened this issue Jan 15, 2016 · 0 comments

Comments

@paulrolfe
Copy link

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant