Skip to content
This repository was archived by the owner on Oct 18, 2022. It is now read-only.

Commit a15959a

Browse files
author
Anna-Mariia Shkarlinska
committed
Update README.md according to customazation
1 parent aaff59f commit a15959a

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

README.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ An easy-to-use Collection View Layout for card-like animation 🎉
2020

2121
## Usage
2222

23+
### Basic Usage
24+
2325
The two main steps are needed for the configuration of *CarLensCollectionViewLayout*:
2426

25-
### Step 1
27+
#### Step 1
2628
Assign `CarLensCollectionViewLayout` to yours collection view layout:
2729
```swift
2830
collectionView.collectionViewLayout = CarLensCollectionViewLayout()
@@ -32,7 +34,7 @@ or initialize your collection view with `CarLensCollectionViewLayout`:
3234
UICollectionView(frame: .zero, collectionViewLayout: CarLensCollectionViewLayout())
3335
```
3436

35-
### Step 2
37+
#### Step 2
3638
Subsclass `CarLensCollectionViewCell` and call `configure(topView: UIView, cardView: UIView)` right on the start!
3739
```swift
3840
class CollectionViewCell: CarLensCollectionViewCell {
@@ -44,6 +46,40 @@ class CollectionViewCell: CarLensCollectionViewCell {
4446
```
4547
The sample implementation is available in [Demo](CarLensCollectionViewLayoutDemo) project.
4648

49+
### Customization
50+
51+
#### Layout
52+
You can also initialize `CarLensCollectionViewLayout` with a `CarLensCollectionViewLayoutOptions` object by passing any of the parameters available. Others will be configured automatically.
53+
54+
**Parameters:**
55+
56+
`minimumSpacing` - A minimum spacing between cells.
57+
58+
`decelerationRate` - A deceleration for a scroll view.
59+
60+
`shouldShowScrollIndicator` - A value indicating whether collection view should have a scroll indicator.
61+
62+
`itemSize` - The size to use for cells.
63+
64+
Example:
65+
```swift
66+
let options = CarLensCollectionViewLayoutOptions(minimumSpacing: 40)
67+
collectionView.collectionViewLayout = CarLensCollectionViewLayout(options: options)
68+
```
69+
70+
#### Cell
71+
While subsclassing `CarLensCollectionViewCell` you can call `configure(...)` with an additional parameter `topViewHeight`. The card view height will be calculated based on this value.
72+
73+
Example:
74+
```swift
75+
class CollectionViewCell: CarLensCollectionViewCell {
76+
override init(frame: CGRect) {
77+
super.init(frame: frame)
78+
configure(topView: upperView, cardView: bottomView, topViewHeight: 300)
79+
}
80+
}
81+
```
82+
4783
## Installation
4884

4985
### CocoaPods

0 commit comments

Comments
 (0)