@@ -12,7 +12,7 @@ import UIKit
12
12
let CollectionViewWaterfallElementKindSectionHeader = " CollectionViewWaterfallElementKindSectionHeader "
13
13
let CollectionViewWaterfallElementKindSectionFooter = " CollectionViewWaterfallElementKindSectionFooter "
14
14
15
- @objc protocol CollectionViewWaterfallLayoutDelegate : UICollectionViewDelegate {
15
+ @objc public protocol CollectionViewWaterfallLayoutDelegate : UICollectionViewDelegate {
16
16
17
17
func collectionView( collectionView: UICollectionView , layout: UICollectionViewLayout , sizeForItemAtIndexPath indexPath: NSIndexPath ) -> CGSize
18
18
@@ -30,49 +30,49 @@ let CollectionViewWaterfallElementKindSectionFooter = "CollectionViewWaterfallEl
30
30
31
31
}
32
32
33
- class CollectionViewWaterfallLayout : UICollectionViewLayout {
33
+ public class CollectionViewWaterfallLayout : UICollectionViewLayout {
34
34
35
35
//MARK: Private constants
36
36
/// How many items to be union into a single rectangle
37
37
private let unionSize = 20 ;
38
38
39
39
//MARK: Public Properties
40
- var columnCount : Int = 2 {
40
+ public var columnCount : Int = 2 {
41
41
didSet {
42
42
invalidateIfNotEqual ( oldValue, newValue: columnCount)
43
43
}
44
44
}
45
- var minimumColumnSpacing : Float = 10.0 {
45
+ public var minimumColumnSpacing : Float = 10.0 {
46
46
didSet {
47
47
invalidateIfNotEqual ( oldValue, newValue: minimumColumnSpacing)
48
48
}
49
49
}
50
- var minimumInteritemSpacing : Float = 10.0 {
50
+ public var minimumInteritemSpacing : Float = 10.0 {
51
51
didSet {
52
52
invalidateIfNotEqual ( oldValue, newValue: minimumInteritemSpacing)
53
53
}
54
54
}
55
- var headerHeight : Float = 0.0 {
55
+ public var headerHeight : Float = 0.0 {
56
56
didSet {
57
57
invalidateIfNotEqual ( oldValue, newValue: headerHeight)
58
58
}
59
59
}
60
- var footerHeight : Float = 0.0 {
60
+ public var footerHeight : Float = 0.0 {
61
61
didSet {
62
62
invalidateIfNotEqual ( oldValue, newValue: footerHeight)
63
63
}
64
64
}
65
- var headerInset : UIEdgeInsets = UIEdgeInsetsZero {
65
+ public var headerInset : UIEdgeInsets = UIEdgeInsetsZero {
66
66
didSet {
67
67
invalidateIfNotEqual ( NSValue ( UIEdgeInsets: oldValue) , newValue: NSValue ( UIEdgeInsets: headerInset) )
68
68
}
69
69
}
70
- var footerInset : UIEdgeInsets = UIEdgeInsetsZero {
70
+ public var footerInset : UIEdgeInsets = UIEdgeInsetsZero {
71
71
didSet {
72
72
invalidateIfNotEqual ( NSValue ( UIEdgeInsets: oldValue) , newValue: NSValue ( UIEdgeInsets: footerInset) )
73
73
}
74
74
}
75
- var sectionInset : UIEdgeInsets = UIEdgeInsetsZero {
75
+ public var sectionInset : UIEdgeInsets = UIEdgeInsetsZero {
76
76
didSet {
77
77
invalidateIfNotEqual ( NSValue ( UIEdgeInsets: oldValue) , newValue: NSValue ( UIEdgeInsets: sectionInset) )
78
78
}
@@ -93,7 +93,7 @@ class CollectionViewWaterfallLayout: UICollectionViewLayout {
93
93
94
94
95
95
//MARK: UICollectionViewLayout Methods
96
- override func prepareLayout( ) {
96
+ override public func prepareLayout( ) {
97
97
super. prepareLayout ( )
98
98
99
99
let numberOfSections = collectionView? . numberOfSections ( )
@@ -261,7 +261,7 @@ class CollectionViewWaterfallLayout: UICollectionViewLayout {
261
261
}
262
262
}
263
263
264
- override func collectionViewContentSize( ) -> CGSize {
264
+ override public func collectionViewContentSize( ) -> CGSize {
265
265
let numberOfSections = collectionView? . numberOfSections ( )
266
266
if numberOfSections == 0 {
267
267
return CGSizeZero
@@ -273,7 +273,7 @@ class CollectionViewWaterfallLayout: UICollectionViewLayout {
273
273
return contentSize!
274
274
}
275
275
276
- override func layoutAttributesForItemAtIndexPath( indexPath: NSIndexPath ) -> UICollectionViewLayoutAttributes ! {
276
+ override public func layoutAttributesForItemAtIndexPath( indexPath: NSIndexPath ) -> UICollectionViewLayoutAttributes ! {
277
277
if indexPath. section >= sectionItemAttributes. count {
278
278
return nil
279
279
}
@@ -285,7 +285,7 @@ class CollectionViewWaterfallLayout: UICollectionViewLayout {
285
285
return sectionItemAttributes [ indexPath. section] [ indexPath. item]
286
286
}
287
287
288
- override func layoutAttributesForSupplementaryViewOfKind( elementKind: String , atIndexPath indexPath: NSIndexPath ) -> UICollectionViewLayoutAttributes ! {
288
+ override public func layoutAttributesForSupplementaryViewOfKind( elementKind: String , atIndexPath indexPath: NSIndexPath ) -> UICollectionViewLayoutAttributes ! {
289
289
var attribute : UICollectionViewLayoutAttributes ?
290
290
291
291
if elementKind == CollectionViewWaterfallElementKindSectionHeader {
@@ -298,7 +298,7 @@ class CollectionViewWaterfallLayout: UICollectionViewLayout {
298
298
return attribute
299
299
}
300
300
301
- override func layoutAttributesForElementsInRect( rect: CGRect ) -> [ AnyObject ] {
301
+ override public func layoutAttributesForElementsInRect( rect: CGRect ) -> [ AnyObject ] {
302
302
var begin : Int = 0
303
303
var end : Int = unionRects. count
304
304
var attrs = [ UICollectionViewLayoutAttributes] ( )
@@ -325,7 +325,7 @@ class CollectionViewWaterfallLayout: UICollectionViewLayout {
325
325
return Array ( attrs)
326
326
}
327
327
328
- override func shouldInvalidateLayoutForBoundsChange( newBounds: CGRect ) -> Bool {
328
+ override public func shouldInvalidateLayoutForBoundsChange( newBounds: CGRect ) -> Bool {
329
329
let oldBounds = collectionView? . bounds
330
330
if CGRectGetWidth ( newBounds) != CGRectGetWidth ( oldBounds!) {
331
331
return true
0 commit comments