To run the example project, clone the repo, and run Example project only used for testing so far
pod install from the Example directory first.
constrain is available through CocoaPods. To install it, simply add the following line to your Podfile:
This library lets you quickly and efficiently set up a number of constraints using intuitive chaining syntax. For example:
let containerView = UIView() let newView = UIView() let centeredView = UIView() containerView.constainSubview(newView).fillSafely() centeredView.constrainIn(containerView).center()
- All constraints are enabled by default
- Adding subviews is handled by
constrainSiblingToBottom(). If you need to add more constraints at a later time, just call
constrainsubsequently to avoid redoing it, although there's no harm in it.
translatesAutoresizingMaskIntoConstraintsis always set to false
- Most methods can also be called with View Controllers, but only the
constrainChild()method handles parent/child UIViewController relationships. Call
remove()to undo it.
anconaesselmann, [email protected]
constrain is available under the MIT license. See the LICENSE file for more info.