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

Multi-binding syntax #63

Open
ZevEisenberg opened this issue Oct 2, 2018 · 0 comments
Open

Multi-binding syntax #63

ZevEisenberg opened this issue Oct 2, 2018 · 0 comments

Comments

@ZevEisenberg
Copy link
Collaborator

Not sure if that's the right term for it, but this idea is inspired by SnapKit, which can do this:

someView.snp.makeConstraints { 
    innerView.width.centerX.top.equalToSuperview()
}

I was thinking that an Anchorage-like way to do that would be something more like this:

innerView.anchors([.width, .centerX, .top]) == otherView

As a convenience, we could also supply a constant that means "the superview of the view to the left of the ==:

innerView.anchors([.width, .centerX, .top]) == Anchorage.Superview() // name TBD

Question: would this work with operators that we use to inset/offset things? I think probably not, just to simplify things. We already provide verticalAnchors, horizontalAnchors, edgeAnchors, and centerAnchors for cases where you would want to pin common combinations with an inset/offset. So, I think this should be a compilation error:

innerView.anchors([.width, .centerX, .top]) == otherView + 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant