<commit_before># Constrainer

[![Build Status](https://travis-ci.org/daehn/Constrainer.svg?branch=develop)](https://travis-ci.org/daehn/Constrainer) [![codecov](https://codecov.io/gh/daehn/Constrainer/branch/develop/graph/badge.svg)](https://codecov.io/gh/daehn/Constrainer) ![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

Constrainer is meant to be a lightweight AutoLayout helper. Constrainer exposes several properties on `UIView` that can be used to construct layout constraints using operators. This mostly was an experiment to see how much of [Cartography](https://github.com/robb/Cartography)'s functionality can be replicated without using proxies only accessible in closures and the syntax of Constrainer is this heavily inspired by [Cartography](https://github.com/robb/Cartography).

```swift
view.leading == imageView.trailing - 20
label.edges <= labelContainerView.margins.edges
let widthConstraint = view.width >= imageView.height / 2 ~ .defaultLow
```

Constrainer does currently **NOT** set `translatesAutoresizingMaskIntoConstraints` to `false` but sets  `isActive` to `true` for all involved views in a expression when creating a constraint.
All expressions return a `NSLayoutConstraint` (or an array of `NSLayoutConstraint` when using `edges` or `center`), which can be stored and used to modify / deactivate the constraint at a later point.

All available properties to construct constraints using Constrainer are:

* `top`
* `bottom`
* `leading`
* `trailing`
* `width`
* `height`
* `left`
* `right`
* `centerY`
* `centerX`
* `firstBaseline`
* `lastBaseline`
* `edges`<commit_msg>Fix comment<commit_after># Constrainer

[![Build Status](https://travis-ci.org/daehn/Constrainer.svg?branch=develop)](https://travis-ci.org/daehn/Constrainer) [![codecov](https://codecov.io/gh/daehn/Constrainer/branch/develop/graph/badge.svg)](https://codecov.io/gh/daehn/Constrainer) ![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

Constrainer is meant to be a lightweight AutoLayout helper. Constrainer exposes several properties on `UIView` that can be used to construct layout constraints using operators. This mostly was an experiment to see how much of [Cartography](https://github.com/robb/Cartography)'s functionality can be replicated without using proxies only accessible in closures and the syntax of Constrainer is this heavily inspired by [Cartography](https://github.com/robb/Cartography).

```swift
view.leading == imageView.trailing - 20
label.edges <= labelContainerView.margins.edges
let widthConstraint = view.width >= imageView.height / 2 ~ .defaultLow
```

Constrainer does currently **NOT** set `translatesAutoresizingMaskIntoConstraints` to `false` but sets  `isActive` to `true` for all created constraints in a expression.
All expressions return a `NSLayoutConstraint` (or an array of `NSLayoutConstraint` when using `edges` or `center`), which can be stored and used to modify / deactivate the constraint at a later point.

All available properties to construct constraints using Constrainer are:

* `top`
* `bottom`
* `leading`
* `trailing`
* `width`
* `height`
* `left`
* `right`
* `centerY`
* `centerX`
* `firstBaseline`
* `lastBaseline`
* `edges`
{'fraction_non_alphanumeric': 0.125642490005711, 'fraction_numerical': 0.0057110222729868645, 'mean_word_length': 5.659695817490494, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4749579', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1057, 'n_words': 306}