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
+78-29Lines changed: 78 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,39 +67,88 @@ Find a demo in the Examples folder.
67
67
68
68
## Properties
69
69
70
-
CollectionViewSlantedLayout contains six properties to customize the interface.
70
+
- **slantingSize**:
71
+
72
+
```swift
73
+
@IBInspectable var slantingSize: UInt
74
+
```
75
+
The slanting size. The default value of this property is `75`.
76
+
77
+
- **slantingDirection**:
78
+
79
+
```swift
80
+
var slantingDirection: SlantingDirection
81
+
```
82
+
The slanting direction. The default value of this property is `upward`.
83
+
84
+
- **slantingAngle**:
85
+
86
+
```swift
87
+
fileprivate(set) var slantingAngle: CGFloat
88
+
```
89
+
The angle, in radians, of the slanting. The value of this property could be used to apply a rotation transform on the cell's contentView in the `collectionView(_:cellForItemAt:)`method implementation.
90
+
91
+
```swift
92
+
if let layout = collectionView.collectionViewLayout as? CollectionViewSlantedLayout {
var scrollDirection: UICollectionViewScrollDirection
100
+
```
101
+
The scroll direction of the grid. The grid layout scrolls along one axis only, either horizontally or vertically. The default value of this property is `vertical`.
102
+
103
+
-**isFistCellExcluded**:
104
+
105
+
```swift
106
+
@IBInspectablevar isFistCellExcluded: Bool
107
+
```
108
+
Allows to disable the slanting for the first cell. Set it to `true` to disable the slanting for the first cell. The default value of this property is `false`.
109
+
110
+
-**isLastCellExcluded**:
111
+
112
+
```swift
113
+
@IBInspectablevar isLastCellExcluded:Bool
114
+
```
115
+
Allows to disable the slanting for the last cell. Set it to `true` to disable the slanting for the last cell. The default value of this property is `false`.
116
+
117
+
-**lineSpacing**:
118
+
119
+
```swift
120
+
@IBInspectablevar lineSpacing: CGFloat
121
+
```
122
+
The spacing to use between two items. The default value of this property is `10.0`.
123
+
124
+
-**itemSize**:
125
+
126
+
```swift
127
+
@IBInspectablevar itemSize: CGFloat
128
+
```
129
+
The default size to use for cells. If the delegate does not implement the `collectionView(_:layout:sizeForItemAt:)` method, the slanted layout uses the value in this property to set the size ofeach cell. This results in cells that all have the same size. The default value of this property is `225`.
130
+
131
+
-**zIndexOrder**:
132
+
133
+
```swift
134
+
var zIndexOrder: ZIndexOrder
135
+
```
136
+
The zIndex order of the items in the layout. The default value of this property is `ascending`.
137
+
138
+
139
+
## Protocols
140
+
141
+
The `CollectionViewDelegateSlantedLayout` protocol defines methods that let you coordinate with a `CollectionViewSlantedLayout` object to implement a slanted layout. The `CollectionViewDelegateSlantedLayout` protocol has the following methods:
71
142
72
143
```swift
73
-
var slantingDelta: UInt
74
-
var slantingDirection: SlantingDirection
75
-
var firstCellSlantingEnabled: Bool
76
-
var lastCellSlantingEnabled: Bool
77
-
var lineSpacing: CGFloat
78
-
var scrollDirection: UICollectionViewScrollDirection
- _slantingDelta_ is the slanting delta. Defaults to `75`
83
-
- _slantingDirection_ allows to set slanting direction. Defaults to `.upward`
84
-
- _firstCellSlantingEnabled_ allows to enable the slanting for the first cell. By default, this property is set to `true`
85
-
- _lastCellSlantingEnabled_ allows to enable the slanting for the last cell. By default, this property is set to `true`
86
-
- _lineSpacing_ is the spacing to use between two items. Defaults to `10.0`
87
-
- _scrollDirection_ is the scroll direction. Defaults to `.vertical`
88
-
- _itemSize_ allows to set the item's defaulf width/height depending on the scroll direction if the delegate does not implement the collectionView(_:layout:sizeForItemAt:) method. Defaults to `225`
89
-
90
-
## Protocols
91
-
92
-
<details>
93
-
<summary>
94
-
```swift
95
-
@IBInspectable open var slantingSize: UInt
96
-
```
97
-
</summary>
98
-
<p>
99
-
The slanting size. By default, this property is set to `75`.
100
-
</p>
101
-
</details>
102
-
149
+
This method asks the delegate for the size of the specified item’s cell.
150
+
151
+
If you do not implement this method, the slanted layout uses the values in its `itemSize` property to set the size of items instead. Your implementation of this method can return a fixed setof sizes or dynamically adjust the sizes based on the cell’s content.
0 commit comments