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
{{ message }}
This repository was archived by the owner on Jun 17, 2023. It is now read-only.
This is a custom `UICollectionViewLayout` that gives you the ability to apply transforms easily on the cells
55
-
by conforming your cell class to `TransformableView` protocol you will get a `progress` value and you can use it to apply any changes on your cell view.
56
-
See [How to use](https://github.com/amirdew/CollectionViewPagingLayout#how-to-use) part for more details.
59
+
CollectionViewPagingLayout is a simple but powerful tool for making complex layouts for your UICollectionView.
60
+
The implementation is very simple there is custom `UICollectionViewLayout` that gives you the ability to apply transforms on the cells.
61
+
No inheritance or anything like that.
62
+
See [How to use](https://github.com/amirdew/CollectionViewPagingLayout#how-to-use) part for more details.
63
+
57
64
58
65
## Installation
59
66
CollectionViewPagingLayout doesn't contain any external dependencies.
- Now you just need to conform your `UICollectionViewCell` class to `TransformableView` and start implementing your custom transforms.
133
+
- Now you just need to conform your `UICollectionViewCell` class to `TransformableView` and start implementing your custom transforms. By conforming your cell class to `TransformableView` protocol you will get a `progress` value and you can use it to apply any changes on your cell view.
114
134
115
-
*Note:* you can use [Prepared Transformable Protocols](#prepared-transformable-protocols) instead of `TransformableView` if you don't want a custom effect!
135
+
136
+
*Note:* you can use [Prepared Transformable Protocols](#prepared-transformable-protocols) instead of `TransformableView` if you want to use prepared effects!
these are safe wrappers for setting `ContentOffset` of `UICollectionview`
218
-
you can also get current page by a public variable `CollectionViewPagingLayout.currentPage` or listen to the changes by setting `CollectionViewPagingLayout.delegate`:
219
-
241
+
you can also get current page by a public variable `CollectionViewPagingLayout.currentPage` or listen to changes by using `CollectionViewPagingLayout.delegate`:
220
242
```swift
221
243
publicprotocolCollectionViewPagingLayoutDelegate: class {
There is built-in solution for handling tap gestues on the views
251
+
- Implement `TransformableView.selectableView` and pass the view that you would like to handle tap gestues for (by default this is the first subview of your `UICollectionViewCell.contentView`)
252
+
- Call `CollectionViewPagingLayout.configureTapOnCollectionView()` after setting the layout for you collection view
253
+
- Set the delegate for layout (`CollectionViewPagingLayout.delegate`)
254
+
- Use didSelectItemAt function `func collectionViewPagingLayout(_ layout: CollectionViewPagingLayout, didSelectItemAt indexPath: IndexPath)`
255
+
226
256
227
257
## Limitations
258
+
- Specify the number of visible cells:
228
259
You need to specify the number of visible cells since this layout gives you the flexibility to show the next and previous cells.
229
260
By default, the layout loads all of the cells in the collection view frame and that means it keeps all of them in memory.
230
261
You can specify the number of cells that you need to show at a time by considering your design.
231
262
263
+
- Touches on cells:
264
+
The way that this layout works is putting all the cells in the collectionview frame (doesn't matter which TransformView you use)
265
+
and then it applies transforms on the target view (StackTransformView.cardView, ScaleTransformView.scalableView etc)
266
+
so you can use `func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)` but only for one cell at the same time
267
+
you can implement `func zPosition(progress: CGFloat) -> Int` to specify wich cell should be on top
268
+
269
+
if you would like to handle tap on multiple cells at the same time see [Handle touches]()
0 commit comments