Skip to content
This repository was archived by the owner on Jun 17, 2023. It is now read-only.

Commit 4426b52

Browse files
authored
Update README.md
1 parent 2e7daac commit 4426b52

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,23 @@ File > Swift Packages > Add Package Dependency
9797
Just add all the files under `Lib` directory to your project
9898

9999
## How to use
100-
- make sure you imported the library
100+
- Make sure you imported the library
101101
```swift
102102
import CollectionViewPagingLayout
103103
```
104+
- Set up your `UICollectionView` as you always do (you need to use a custom class for cells)
104105
- Set the layout for your collection view:
105-
(in most cases you want a paging effect so make sure you enable it)
106+
(in most cases you want a paging effect so enable that too)
106107
```swift
107108
let layout = CollectionViewPagingLayout()
108109
collectionView.collectionViewLayout = layout
109110
collectionView.isPagingEnabled = true // enabling paging effect
110111
```
111112

112-
- Then you can set `numberOfVisibleItems`, by default it's null and that means it will load all of the cells at a time
113-
```swift
114-
layout.numberOfVisibleItems = ...
115-
```
116-
- Now you just need to conform your `UICollectionViewCell` class to `TransformableView` and start implementing your custom transforms
113+
- Now you just need to conform your `UICollectionViewCell` class to `TransformableView` and start implementing your custom transforms.
114+
115+
*Note:* you can use [prepared transformable protocols](#prepared-transformable-protocols) instead of `TransformableView` if you don't want a custom effect!
116+
117117
> `progress` is a float value that represents the current position of your cell in the collection view.
118118
> When it's `0` that means the current position of the cell is exactly in the center of your collection view.
119119
> the value could be negative or positive and that represents the distance to the center of your collection view.
@@ -140,6 +140,11 @@ extension MyCollectionViewCell: TransformableView {
140140
}
141141
```
142142

143+
- Don't forget to set `numberOfVisibleItems`, by default it's null and that means it will load all of the cells at a time
144+
```swift
145+
layout.numberOfVisibleItems = ...
146+
```
147+
143148
## Prepared Transformable Protocols
144149

145150
There are prepared transformables to make it easier to use this library,

0 commit comments

Comments
 (0)