Skip to content

JamieREvans/LayoutSwiftly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LayoutSwiftly

CI Status Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

import LayoutSwiftly

private func buildUI()
{
    let redView = self.addViewWithColor(UIColor.redColor())
    let purpleView = self.addViewWithColor(UIColor.purpleColor())
    let greenView = self.addViewWithColor(UIColor.greenColor())

    self.view.alignViewsHorizontally([redView, greenView, purpleView], horizontalSeparations: [50.0, 50.0, -20.0, 20.0], widths: [50.0, 30.0, 0.0])
    self.view.alignViewsVertically([redView, greenView], verticalSeparations: [150.0, 20.0], heights: [50.0, 100.0])
    self.view.alignViewsVertically([redView, purpleView], verticalSeparations: [10.0], heights: [0.0, 50.0])
}

private func addViewWithColor(color: UIColor) -> UIView
{
    let coloredView = UIView()
    coloredView.translatesAutoresizingMaskIntoConstraints = false
    coloredView.backgroundColor = color
    self.view.addSubview(coloredView);

    return coloredView
}

example

Requirements

Installation

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

pod "LayoutSwiftly"

Author

JamieREvans, jamie.riley.evans@gmail.com

License

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

About

Layout all of your views in one go with Swift and Visual Autolayout

Resources

License

Stars

Watchers

Forks

Packages

No packages published