You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 15, 2019. It is now read-only.
Concise API for iOS Auto Layout. SnapLayout extends `UIView` to deliver a list of APIs to improve readability while also shortening constraint code. Internally using AutoLayout to provide the best experience. With SnapLayout, developers can pin, anchor, snap, or align views easily!
8
+
Concise API for iOS Auto Layout. SnapLayout extends `UIView` to deliver a list of APIs to improve readability while also shortening constraint code. Internally uses AutoLayout to provide the best experience. With SnapLayout, developers can remove boilerplate code but not at the cost of readability.
9
+
10
+
Imagine applying any or all of the following constraints in one line of code: top, leading, trailing, bottom, width, height, centerX, centerY. This is possible with `SnapLayout`.
9
11
10
12
### Table of Contents
11
-
1.[Setup](#setup)
12
-
* [Requirements](#requirements)
13
-
* [Installation](#installation)
14
-
1.[Usage](#usage)
15
-
* [Sample Code](#sample-code)
16
-
* [Example App](#example-app)
13
+
1.[Setup](#setup)
14
+
*[Requirements](#requirements)
15
+
*[Installation](#installation)
16
+
2.[Usage](#usage)
17
+
*[Sample Code](#sample-Code)
18
+
*[Example App](#example-app)
17
19
18
20
## Setup
19
21
### Requirements
20
-
SnapLayout's current release supports iOS >= 9.0
21
-
22
22
* Xcode
23
23
* Language Support: **Swift***(3.0)*
24
24
* Fully Compatible With: **Xcode 8.0 and higher**
@@ -36,64 +36,50 @@ it, simply add the following line to your Podfile:
36
36
pod "SnapLayout"
37
37
```
38
38
39
+
## Overview
40
+
SnapLayout offers many `UIView` extension methods available in the [source files](SnapLayout/SnapLayout/Classes/SnapLayout.swift).
41
+
42
+
* All methods are prefixed with `snap` for quick Xcode autocomplete.
43
+
* Directly uses NSLayoutAnchor under the hood so the API is developer friendly
44
+
* Any view using `SnapLayout` will not only have its `translatesAutoresizingMaskIntoConstraints` set to false, but also have its constraint activated.
45
+
* Amazing constraint situations such as snapping a button to the label on top of it is an effortless process now: `button.snapVertically(topView: label, constant: 8)`
Not only has this button applied 4 constraints, but each individual constraint is accessible through the returned `ConstraintManager`. The beauty of SnapLayout is not only its power interface, but how easy it is to adjust returned constraints. Other API's simply return an array, but not SnapLayout. Each constraint is neatly packaged into a `ConstraintManager`.
85
70
86
-
### Notes
87
-
All of the UIView Extensions return a `ConstraintManager`. This holds all of the applied constraints. Imagine a scenario where a view has a height constraint and pinned to the top, leading, and trailing of super view. Both of these constraints exist within their respective `ConstraintManager`. This manager also has a handy `append` function which combines another constraint manager with itself. In the following example, `loginConstraintManager` holds many initalized properties so a developer can quickly access the `height`, `top`, `leading`, and `trailing` constraints through `loginConstraintManager `.
71
+
### Constants
72
+
A `ConstraintConstants` struct is also available where a developer may list all of their constraint constants beforehand and provide a `ConstraintConstants ` struct to the snap method argument.
88
73
89
74
```swift
90
-
let loginConstraintManager = loginButton.anchorHeightToSuperview()
0 commit comments