Skip to content

Commit d878ef0

Browse files
authored
Update README.md
1 parent e197fe9 commit d878ef0

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
## Example
99

10-
To run the example project, clone the repo, and run `pod install` from the Example directory first.
10+
~To run the example project, clone the repo, and run `pod install` from the Example directory first.~ Example project only used for testing so far
1111

1212
## Requirements
1313

@@ -20,6 +20,24 @@ it, simply add the following line to your Podfile:
2020
pod 'constrain'
2121
```
2222

23+
## Usage
24+
25+
This library lets you quickly and efficiently set up a number of constraints using intuitive chaining syntax. For example:
26+
27+
```swift
28+
let containerView = UIView()
29+
let newView = UIView()
30+
let centeredView = UIView()
31+
containerView.constainSubview(newView).fillSafely()
32+
centeredView.constrainIn(containerView).center()
33+
```
34+
35+
Notes:
36+
- All constraints are enabled by default
37+
- Adding subviews is handled by `constrainSubview()`, `constrainIn()`, `constrainSibling()`, `constrainSiblingToTrailing()`, or `constrainSiblingToBottom()`. If you need to add more constraints at a later time, just call `constrain` subsequently to avoid redoing it, although there's no harm in it.
38+
- `translatesAutoresizingMaskIntoConstraints` is always set to false
39+
- Most methods can also be called with View Controllers, but only the `constrainChild()` method handles parent/child UIViewController relationships. Call `remove()` to undo it.
40+
2341
## Author
2442

2543
anconaesselmann, axel@anconaesselmann.com

0 commit comments

Comments
 (0)