|2,185||lines of code|
The ultimate API for iOS & OS X Auto Layout — impressively simple, immensely powerful. PureLayout extends
NSLayoutConstraint with a comprehensive Auto Layout API that is modeled after Apple's own frameworks. PureLayout is an Objective-C library that also works (and looks!) great with Swift using a bridging header.
Writing Auto Layout code from scratch isn't easy. PureLayout provides a fully capable and developer-friendly interface for Auto Layout. It is designed for clarity and simplicity, and takes inspiration from the AutoLayout UI options available in Interface Builder while delivering far more flexibility. The API is also highly efficient, as it adds only a thin layer of third party code and is engineered for maximum performance.
The ultimate API for iOS Auto Layout -- impressively simple, immensely powerful. Comprised of categories on
UIView+AutoLayout provides a developer-friendly interface for the vast majority of Auto Layout use cases. It is designed for clarity and simplicity, taking inspiration from the Auto Layout UI options available in Interface Builder but delivering far more flexibility and capability. The API is also highly efficient, as it adds only a thin layer of third party code and is engineered for maximum performance (for example, by automatically adding constraints to the nearest ancestor view).
This is just a handy overview of the core API methods. Check out the header file for the full API and documentation. A couple notes:
auto...for easy autocompletion!
relation:parameter to make the constraint an inequality.
+ autoRemoveConstraint(s): - autoRemoveConstraintsAffectingView(AndSubviews) + autoSetPriority:forConstraints: - autoSetContent(CompressionResistance|Hugging)PriorityForAxis: - autoCenterInSuperview: - autoAlignAxisToSuperviewAxis: - autoPinEdgeToSuperviewEdge:withInset: - autoPinEdgesToSuperviewEdges:withInsets:(excludingEdge:) - autoPinEdge:toEdge:ofView:(withOffset:) - autoAlignAxis:toSameAxisOfView:(withOffset:) - autoMatchDimension:toDimension:ofView:(withOffset:|withMultiplier:) - autoSetDimension(s)ToSize: - autoConstrainAttribute:toAttribute:ofView:(withOffset:|withMultiplier:) - autoPinTo(Top|Bottom)LayoutGuideOfViewController:withInset:
- autoAlignViewsToEdge: - autoAlignViewsToAxis: - autoMatchViewsDimension: - autoSetViewsDimension:toSize: - autoDistributeViewsAlongAxis:withFixedSpacing:(insetSpacing:)alignment: - autoDistributeViewsAlongAxis:withFixedSize:(insetSpacing:)alignment:
- autoInstall - autoRemove