-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Labels
Description
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]) == otherViewAs 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 TBDQuestion: 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