Skip to content

Commit 89ded19

Browse files
authored
Merge pull request #30 from HotCocoaTouch/update-readme-some-more
Update readme
2 parents 3c77eb7 + 2567fa9 commit 89ded19

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

README.md

+14-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ A declarative, expressive and efficient way to lay out your views.
1818
**Flexible** | Write the same constraints you already do, using whatever autolayout constraint DSL you prefer.
1919
**Small** | Small and readable Swift 4 codebase.
2020

21+
[Usage](#usage) | [Updating to a new layout](#updating-to-a-new-layout) | [Installation](#installation) | [Requirements](#requirements)
22+
| [Building on top of DeclarativeLayout](#building-on-top-of-declarativelayout) |
23+
[License](#license)
24+
2125
---
2226

2327
## Usage
@@ -44,7 +48,9 @@ viewLayout.updateLayoutTo { (component) in
4448
}
4549
```
4650

47-
Use the layout components to define new views that should be in the hierarchy, as well as the constraints that should be active.
51+
Use the layout components to define new views that should be in the hierarchy,
52+
as well as the constraints that should be active (Note: All constraints passed
53+
to `activate(_:)` method should not be active).
4854

4955
Here is an example:
5056

@@ -57,6 +63,7 @@ viewLayout.updateLayoutTo { (component) in
5763
component.view.topAnchor.constraint(equalTo: component.superview.safeAreaLayoutGuide.topAnchor,
5864
constant: 35),
5965
])
66+
6067
component.view.axis = .vertical
6168
component.addArrangedView(self.redView) { (component) in
6269
component.activate([
@@ -99,7 +106,9 @@ viewLayout.updateLayoutTo { (component) in
99106

100107
That will give you a view looking like this:
101108

102-
<img src="/Resources/layout1.png" width=400 />
109+
<img src="/Resources/layout1.png" height=500 />
110+
111+
## Updating to a new layout
103112

104113
If you want to update to a new layout, just call the `updateLayoutTo` method
105114
again, defining what your layout should be. The framework will take care of
@@ -108,9 +117,9 @@ modifying constraints.
108117

109118
As an example, let's randomly order these views, the spacing inbetween them and
110119
their height, re-updating the layout in this way every few seconds. The result
111-
will look like this:
120+
will look something like this:
112121

113-
![Video animating change](/Resources/animateChange.gif)
122+
<img src="/Resources/animateChange.gif" height=500 />
114123

115124
```swift
116125
let views = [redView,
@@ -128,6 +137,7 @@ viewLayout.updateLayoutTo { (component) in
128137
component.view.topAnchor.constraint(equalTo: component.superview.safeAreaLayoutGuide.topAnchor,
129138
constant: 35),
130139
])
140+
131141
component.view.axis = .vertical
132142
for view in views.shuffled() {
133143
component.addArrangedView(view) { (component) in
@@ -154,7 +164,6 @@ pod "DeclarativeLayout"
154164
## Requirements
155165

156166
* iOS 9.0 or later
157-
* Xcode 9 or later
158167
* Supports Swift 4.2
159168

160169
## Building on top of DeclarativeLayout

Resources/animateChange.gif

-467 KB
Loading

0 commit comments

Comments
 (0)