sora0077 / Constraint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Constraint

Requirements

  • iOS 9.0+
  • Xcode 9.3+
  • Swift 4.1+

Installation

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Constraint into your Xcode project using Carthage, specify it in your Cartfile:

github "sora0077/Constraint" "master"

Run carthage update to build the framework and drag the built Constraint.framework into your Xcode project.

Usage

Quick Start

import Constraint

class MyViewController: UIViewController {

    lazy var box = UIView()

    override func viewDidLoad() {
        super.viewDidLoad()

        view.addSubview(box)
        constrain(box) { box in
            box.size.equalTo(50)
            box.center.equalTo(box.superview.center)
        }
    }
}

About

License:MIT License


Languages

Language:Swift 98.8%Language:Ruby 0.6%Language:Objective-C 0.6%