Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
paololeonardi committed Nov 3, 2019
1 parent 3ad1638 commit 95513a3
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ A grid of views of type `Image` from a collection of data identified by a key pa

```swift
WaterfallGrid((0..<10), id: \.self) { index in
Image("image\(index)")
.resizable()
.aspectRatio(contentMode: .fit)
Image("image\(index)")
.resizable()
.aspectRatio(contentMode: .fit)
}
```

Expand All @@ -84,7 +84,7 @@ A grid of views of type `RectangleView` from a collection of `Identifiable` data

```swift
WaterfallGrid(rectangles) { rectangle in
RectangleView(rectangle: rectangle)
RectangleView(rectangle: rectangle)
}
```
or, for simple cases like this, just:
Expand All @@ -101,25 +101,25 @@ To customise the appearance of the grid call the `gridStyle` function and pass t

```swift
WaterfallGrid(cards) { card in
CardView(card: card)
CardView(card: card)
}
.gridStyle(columns: 2)
```

```swift
WaterfallGrid(cards, content: CardView.init)
.gridStyle(
columnsInPortrait: 2,
columnsInLandscape: 3
columnsInPortrait: 2,
columnsInLandscape: 3
)
```

**Scroll direction**

```
```swift
WaterfallGrid(rectangles, content: RectangleView.init)
.gridStyle(
scrollDirection: .horizontal
scrollDirection: .horizontal
)
```
<p align="center">
Expand All @@ -129,20 +129,20 @@ WaterfallGrid(rectangles, content: RectangleView.init)

**Spacing and Padding**

```
```swift
WaterfallGrid(rectangles, content: RectangleView.init)
.gridStyle(
spacing: 8,
padding: EdgeInsets(top: 16, leading: 8, bottom: 16, trailing: 8)
spacing: 8,
padding: EdgeInsets(top: 16, leading: 8, bottom: 16, trailing: 8)
)
```

**Animation**

```
```swift
WaterfallGrid(rectangles, content: RectangleView.init)
.gridStyle(
animation: .easeInOut(duration: 0.5)
animation: .easeInOut(duration: 0.5)
)
```

Expand Down

0 comments on commit 95513a3

Please sign in to comment.