Skip to content

Commit d152edb

Browse files
Rik van den Brulemmatoszko
authored andcommitted
Use swift naming in render direction enum
1 parent c7bb559 commit d152edb

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

Example/Example/WaterfallCollectionViewLayout.swift

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ fileprivate func > <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
3232
}
3333
}
3434

35-
3635
@objc protocol CHTCollectionViewDelegateWaterfallLayout: UICollectionViewDelegate, UICollectionViewDataSource {
3736

3837
func collectionView (_ collectionView: UICollectionView,layout collectionViewLayout: UICollectionViewLayout,
@@ -52,9 +51,7 @@ fileprivate func > <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
5251
}
5352

5453
enum CHTCollectionViewWaterfallLayoutItemRenderDirection : NSInteger{
55-
case chtCollectionViewWaterfallLayoutItemRenderDirectionShortestFirst
56-
case chtCollectionViewWaterfallLayoutItemRenderDirectionLeftToRight
57-
case chtCollectionViewWaterfallLayoutItemRenderDirectionRightToLeft
54+
case shortestFirst, leftToRight, rightToLeft
5855
}
5956

6057
class CHTCollectionViewWaterfallLayout : UICollectionViewLayout{
@@ -90,14 +87,12 @@ class CHTCollectionViewWaterfallLayout : UICollectionViewLayout{
9087
didSet{
9188
invalidateLayout()
9289
}}
93-
94-
95-
var itemRenderDirection : CHTCollectionViewWaterfallLayoutItemRenderDirection = .chtCollectionViewWaterfallLayoutItemRenderDirectionShortestFirst{
90+
91+
var itemRenderDirection : CHTCollectionViewWaterfallLayoutItemRenderDirection = .shortestFirst {
9692
didSet{
9793
invalidateLayout()
9894
}}
99-
100-
95+
10196
// private property and method above.
10297
weak var delegate : CHTCollectionViewDelegateWaterfallLayout?{
10398
get{
@@ -332,7 +327,6 @@ class CHTCollectionViewWaterfallLayout : UICollectionViewLayout{
332327
*
333328
* @return index for the longest column
334329
*/
335-
336330
func longestColumnIndex() -> NSInteger {
337331
var index = 0
338332
var longestHeigth:CGFloat = 0.0
@@ -354,11 +348,11 @@ class CHTCollectionViewWaterfallLayout : UICollectionViewLayout{
354348
func nextColumnIndexForItem (_ item : NSInteger) -> Int {
355349
var index = 0
356350
switch (self.itemRenderDirection){
357-
case .chtCollectionViewWaterfallLayoutItemRenderDirectionShortestFirst :
351+
case .shortestFirst:
358352
index = self.shortestColumnIndex()
359-
case .chtCollectionViewWaterfallLayoutItemRenderDirectionLeftToRight :
353+
case .leftToRight:
360354
index = (item%self.columnCount)
361-
case .chtCollectionViewWaterfallLayoutItemRenderDirectionRightToLeft:
355+
case .rightToLeft:
362356
index = (self.columnCount - 1) - (item % self.columnCount);
363357
}
364358

0 commit comments

Comments
 (0)