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
Copy file name to clipboardExpand all lines: README.md
+99
Original file line number
Diff line number
Diff line change
@@ -5,3 +5,102 @@ A collection view layout capable of laying out views in vertically and horizonta
5
5
## Introduction
6
6
7
7
`SwiftyCollectionViewFlowLayout` is a `UICollectionViewLayout` subclass for laying out vertically and horizontal scrolling grids and lists of items. Compared to `UICollectionViewFlowLayout`, `SwiftyCollectionViewFlowLayout` supports many additional features:
8
+
9
+
- Support `Vertical` and `Horizontal` scroll direction.
10
+
- Support water-flow and grid list.
11
+
- Section background decoration that can be hidden/visible on a per-section basis.
12
+
- Hiding or showing headers and footers on a per-section basis.
13
+
- Self-sizing headers and footers.
14
+
- Headers and footers offset.
15
+
- Headers and footer direction.
16
+
- Per-item self-sizing preferences (self-size and statically-size items anywhere in your collection view).
17
+
- Item width/height based on a fraction of the total available width/height.
18
+
19
+
## Preview
20
+
21
+
## Getting Start
22
+
23
+
### Requirements
24
+
25
+
- Deployment target iOS 11.0+
26
+
- Swift 5+
27
+
- Xcode 14+
28
+
29
+
### Installation
30
+
31
+
#### CocoaPods
32
+
33
+
```ruby
34
+
pod 'SwiftyCollectionViewFlowLayout'
35
+
```
36
+
37
+
### Usage
38
+
39
+
Once you've integrated the `SwiftyCollectionViewFlowLayout` into your project, using it with a collection view is easy.
40
+
41
+
#### Setting up cells and headers
42
+
43
+
`SwiftyCollectionViewFlowLayout` requires its own UICollectionViewCell and UICollectionReusableView subclasses:
44
+
45
+
-`SwiftyCollectionViewCell`
46
+
-`SwiftyCollectionReusableView`
47
+
48
+
These two types enable cells and supplementary views to self-size correctly when using `SwiftyCollectionViewFlowLayout` .
49
+
50
+
#### Importing SwiftyCollectionViewFlowLayout
51
+
52
+
At the top of the file where you'd like to use `SwiftyCollectionViewFlowLayout`, import `SwiftyCollectionViewFlowLayout`.
53
+
54
+
```swift
55
+
importSwiftyCollectionViewFlowLayout
56
+
```
57
+
58
+
#### Setting up the collection view
59
+
60
+
Create your UICollectionView instance, passing in a `SwiftyCollectionViewFlowLayout` instance for the layout parameter.
61
+
62
+
```swift
63
+
let layout =SwiftyCollectionViewFlowLayout()
64
+
layout.scrollDirection= .vertical
65
+
66
+
let collectionView =UICollectionView(frame: .zero, collectionViewLayout: layout)
0 commit comments