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
Compile Time Mismatch Errors & centerAnchors #18
Compile Time Mismatch Errors & centerAnchors #18
Conversation
…ors when constraining incompatible edge groups
…ssertion in ConstraintBuilder can stay - naming convention
… and support centerX/centerY pair - Generalized EdgeConstraints -> (now ConstraintGroup) struct as above - Removed need for enum (downside to this: coding the inversion of constants on a case-by-case basis)
b2c69db
to
c9883d1
Compare
var constraintBuilder = ConstraintBuilder(horizontal: >=, vertical: >=) | ||
public struct EdgeAnchors: LayoutAnchorType { | ||
let horizontalAnchors: AnchorPair<NSLayoutXAxisAnchor, NSLayoutXAxisAnchor> | ||
let verticalAnchors: AnchorPair<NSLayoutYAxisAnchor, NSLayoutYAxisAnchor> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#req change to var
} | ||
|
||
} | ||
|
||
// MARK: - Constraint Builders | ||
|
||
private struct ConstraintBuilder { | ||
struct ConstraintBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#? Can we fileprivate
this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidentally made this a review. It's non-blocking of course, but let's address the other questions on this branch before merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but my understanding of Swift 3 access control is we'd need to make it fileprivate
within #if swift (>=3.0)
and duplicate the method as private
within the else
, and do the same thing for AxisAnchors’ and EdgeAnchors’ constraints
functions that take a ConstraintBuilder as a parameter. Is this correct, and if so, is it worth the extra code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm not sure if it really matters since these aren't marked as public
and therefore can't be accessed outside the module anyway. If someone drags in the .swift
, they'll have access outside the file, but most people will probably incorporate via Cocoapods
My comment got deleted so here's what it said roughly: @nevillco These changes look good to me, my only concern is that now
which doesn't really make sense. This produces a |
Yea, I agree, but I don't think it's a new issue, it's just worse with the addition of Center. We could create |
Yeah it's not a new issue, just exacerbated by centerAnchors, and will only get worse. |
Yeah, I agree on the issue, but as a user I'm not sure I like the tradeoff of the ambiguous property names in |
6c4b7ab
to
b842159
Compare
- EdgeAnchors let -> var - Split ConstraintGroup into EdgeGroup and AxisGroup, eliminating nullability but gives ambiguous constraint names in AxisGroup - Indentation fixes
b842159
to
369d543
Compare
Fixes #8 and #13:
AnchorPair
struct that creates constraints along 2 edges (or both centers)LayoutEdge
enum (downside to this: "transforming" constraints is handled case-by-case)EdgeAnchors
composes fromhorizontalAnchors
andverticalAnchors
ConstraintBuilder
andEdgeConstraints
(renamed toConstraintGroup
) add support for center anchors