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

Acknowledge Apple's current AutoLayout syntax in Readme (since iOS 9.0) #259

Open
sovata8 opened this issue May 11, 2017 · 1 comment
Open

Comments

@sovata8
Copy link

sovata8 commented May 11, 2017

I think it would be a good idea to acknowledge the fact that, while Apple's original AutoLayout API syntax is indeed very verbose, since iOS9 it can be rewritten using their anchor syntax.

For example this code from the Readme file:

addConstraint(NSLayoutConstraint(
    item: button1,
    attribute: .Right,
    relatedBy: .Equal,
    toItem: button2,
    attribute: .Left,
    multiplier: 1.0,
    constant: -12.0
))

becomes:

button1.rightAnchor.constraint(equalTo: button2.leftAnchor, constant: -12.0)

And indeed this points to the fact that in some cases, Apple's anchor syntax is pretty good (in this specific case, it's shorter than Cartography's).

Of course in many other cases Cartography's syntax is probably still shorter even than Apple's revised syntax.
Moreover, if a user targets lower than iOS9, then Cartography offers a solution there.

But I think users should be made aware of this revised Apple syntax, so they can make an informed decision about the best solution for their project.

@orta
Copy link
Collaborator

orta commented May 11, 2017

Sure, PRs are welcome.

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

2 participants