Acknowledge Apple's current AutoLayout syntax in Readme (since iOS 9.0)
#188 ouverte le 11 mai 2017
Métriques du dépôt
- Stars
- (7 604 étoiles)
- Métriques de merge PR
- (Aucune PR mergée en 30 j)
Description
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 line from the Readme file:
NSLayoutConstraint(item: view1, attribute: .top, relatedBy: .equal, toItem: view2, attribute: .bottom, multiplier: 1.0, constant: 0.0).active = true
becomes:
view1.topAnchor.constraint(equalTo: view2.bottomAnchor).isActive = true
Of course in many other cases PureLayout's syntax is still shorter even than Apple's revised syntax. Moreover, if a user targets lower than iOS9, then PureLayout 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.