Latest 0.1.2
Homepage https://github.com/robbroadwell/layoutpod
License MIT
Platforms ios 10.0
Authors

[![CI Status](http://img.shields.io/travis/Rob Broadwell/layoutpod.svg?style=flat)](https://travis-ci.org/Rob Broadwell/layoutpod)
Version
License
Platform

Requirements

Swift 3.0 and iOS 10.

Installation

layoutpod is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "layoutpod"

Usage

Adds the following extensions to UIView, simplifying the creation of programatic constraints, and improving the maintainability, readibility and DRYness of views.

view.addSubviewProgramatically(subview)
view.constrainLeftRight(subview)
view.constrainTopBottom(subview)
view.constrainAllSides(subview)
view.constrainCenter(subview)

To add a subview and constrain it to all four sides:

view.addSubviewProgramatically(subview)
view.constrainAllSides(subview)

Two lines, as opposed to six (without the library):

view.addSubview(subview)
subview.translatesAutoresizingMaskIntoConstraints = false

view.addConstraint(subview.leftAnchor.constraint(equalTo: view.leftAnchor))
view.addConstraint(subview.rightAnchor.constraint(equalTo: view.rightAnchor))
view.addConstraint(subview.topAnchor.constraint(equalTo: view.topAnchor))
view.addConstraint(subview.bottomAnchor.constraint(equalTo: view.bottomAnchor))

You can also pass an optional ‘padding’ constant:

view.constrainLeftRight(subview, 20.0)
view.constrainTopBottom(subview, 20.0)
view.constrainAllSides(subview, 20.0)

Pull Requests

Yes! If you have an idea please open a ticket or create a pull request.

Authors

Rob Broadwell, [email protected]

Viktor Faulkner, [email protected]

License

layoutpod is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "layoutpod",
    "version": "0.1.2",
    "summary": "A library that simplifies NSLayoutAnchorConstraints.",
    "description": "NSLayoutAnchors can get wordy, for example, four lines are required to constrain a subview to all four sides of the superview. This library allows you to do the same constraint with a single line. When developing views programatically, this library will greatly reduce the amount of code, and vastly improve the DRYness of the code.",
    "homepage": "https://github.com/robbroadwell/layoutpod",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Rob Broadwell": "[email protected]"
    },
    "source": {
        "git": "https://github.com/robbroadwell/layoutpod.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "layoutpod/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This