From bf2b655946f4083a5c74b252eb20d56a5611add2 Mon Sep 17 00:00:00 2001 From: Paolo Leonardi <pao.leonardi@gmail.com> Date: Sat, 11 Jan 2020 17:51:19 +0000 Subject: [PATCH] Update README.md --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 507b919..be95437 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Once you have your Swift package set up, adding WaterfallGrid as a dependency is ```swift dependencies: [ - .package(url: "https://github.com/paololeonardi/WaterfallGrid.git", from: "0.3.0") + .package(url: "https://github.com/paololeonardi/WaterfallGrid.git", from: "0.4.0") ] ``` @@ -52,7 +52,7 @@ dependencies: [ You can install `WaterfallGrid` via CocoaPods by adding the following line to your `Podfile`: ```ruby -pod 'WaterfallGrid', '~> 0.3.0' +pod 'WaterfallGrid', '~> 0.4.0' ``` Run the `pod install` command to download the library @@ -60,7 +60,7 @@ and integrate it into your Xcode project. ## Usage -### Initialisation +### Initialization You can create a grid that displays the elements of collection by passing your collection of data and a closure that provides a view for each element in the collection. The grid transforms each element in the collection into a child view by using the supplied closure. @@ -114,38 +114,61 @@ WaterfallGrid(cards, content: CardView.init) ) ``` -**Scroll direction** +**Spacing and Padding** ```swift WaterfallGrid(rectangles, content: RectangleView.init) .gridStyle( - scrollDirection: .horizontal + spacing: 8, + padding: EdgeInsets(top: 16, leading: 8, bottom: 16, trailing: 8) ) ``` -<p align="center"> - <img src="https://paololeonardi.github.io/waterfallgrid/resources/animation4.gif" alt="Animation Demo 4"/> - <img src="https://paololeonardi.github.io/waterfallgrid/resources/animation5.gif" alt="Animation Demo 5"/> -</p> -**Spacing and Padding** +**Animation** ```swift WaterfallGrid(rectangles, content: RectangleView.init) .gridStyle( - spacing: 8, - padding: EdgeInsets(top: 16, leading: 8, bottom: 16, trailing: 8) + animation: .easeInOut(duration: 0.5) ) ``` -**Animation** +### Scroll Behaviour + +**Scroll direction & Indicators** ```swift WaterfallGrid(rectangles, content: RectangleView.init) +.scrollOptions( + direction: .horizontal, + showsIndicators: true +) +``` +<p align="center"> + <img src="https://paololeonardi.github.io/waterfallgrid/resources/animation4.gif" alt="Animation Demo 4"/> + <img src="https://paololeonardi.github.io/waterfallgrid/resources/animation5.gif" alt="Animation Demo 5"/> +</p> + +### A Complete Example + +```swift +WaterfallGrid(cards) { card in + CardView(card: card) +} .gridStyle( + columnsInPortrait: 2, + columnsInLandscape: 3, + spacing: 8, + padding: EdgeInsets(top: 16, leading: 8, bottom: 16, trailing: 8), animation: .easeInOut(duration: 0.5) ) +.scrollOptions( + direction: .horizontal, + showsIndicators: true +) ``` + ## Sample App Explore the `WaterfallGridSample` app for some more detailed and interactive examples. @@ -163,7 +186,11 @@ Explore the `WaterfallGridSample` app for some more detailed and interactive exa ## Versioning -For the versions available, see the [tags on this repository](https://github.com/paololeonardi/WaterfallGrid/tags). +For the versions available, see the [releases on this repository](https://github.com/paololeonardi/WaterfallGrid/releases). + +## Contributing + +Contributions are more than welcome. Please create a GitHub issue before submitting a pull request to plan and discuss implementation. ## Author * [Paolo Leonardi](https://github.com/paololeonardi) ([@paololeonardi](https://twitter.com/paololeonardi))