Latest1.0
Homepagehttps://github.com/roelspruit/RSLayout
LicenseMIT
Platformsios 9.1, requires ARC
Authors

Build Status

This is a collection of helper functions to layout views in Swift.

Features

  • Set the width, height or size of a view
  • Center a view horizontally or vertically in its superview
  • Size a view to the width or height of its superview
  • Size a view to fill its superview

Usage

Changing the size of a view

Change the width or height of a view

view.layoutWidth(30.0)
view.layoutHeight(40.0)

Or change both width and height at once

view.layoutHeight(30.0)

Full width or height

Fill the view’s width or height out to its superview

view.layoutFullWidth()
view.layoutFullHeight()

Add an optional margin to the leading / trailing or top / bottom edge of the view

layout.layoutFullWidth(10.0)
layout.layoutFullHeight(10.0)

Centering

Center a view in its superview horizontally or vertically

view.layoutCenterHorizontally()
view.layoutCenterVertically()

Or center it in both directions

view.layoutCenter()

Storing the created constraints

If you want you can store the constraints that RSLayout creates in order to clear them or replace them later on.

let constraintGroup = view.layoutFullWidth()

view.clearConstraintGroup(constraintGroup)

view.layoutWidth(30.0)

Latest podspec

{
    "name": "RSLayout",
    "version": "1.0",
    "license": "MIT",
    "summary": "A collection of helper functions to layout elements in Swift",
    "homepage": "https://github.com/roelspruit/RSLayout",
    "authors": {
        "Roel Spruit": "[email protected]"
    },
    "source": {
        "git": "https://github.com/roelspruit/RSLayout.git",
        "tag": "1.0"
    },
    "platforms": {
        "ios": "9.1"
    },
    "source_files": "Source/*.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This