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
}
LayoutSwiftly is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "LayoutSwiftly"
JamieREvans, jamie.riley.evans@gmail.com
LayoutSwiftly is available under the MIT license. See the LICENSE file for more info.