File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,15 @@ import UIKit
3
3
class ComponentsController : UIViewController {
4
4
5
5
private let componentViews : [ ComponentView ]
6
+ static let reuseIdentifier = " ComponentCell "
6
7
7
8
lazy var collectionView : UICollectionView = { [ unowned self] in
8
9
let layout = UICollectionViewFlowLayout ( )
9
10
layout. itemSize = self . view. bounds. size
10
11
11
12
let collectionView = UICollectionView ( frame: UIScreen . mainScreen ( ) . bounds, collectionViewLayout: layout)
12
13
collectionView. dataSource = self
13
- collectionView. registerClass ( UICollectionViewCell . self, forCellWithReuseIdentifier: " ComponentCell " )
14
+ collectionView. registerClass ( UICollectionViewCell . self, forCellWithReuseIdentifier: reuseIdentifier )
14
15
15
16
return collectionView
16
17
} ( )
@@ -34,7 +35,7 @@ extension ComponentsController: UICollectionViewDataSource {
34
35
35
36
func collectionView( collectionView: UICollectionView , cellForItemAtIndexPath indexPath: NSIndexPath ) -> UICollectionViewCell {
36
37
let view = componentViews [ indexPath. item]
37
- let cell = collectionView. dequeueReusableCellWithReuseIdentifier ( " ComponentCell " , forIndexPath: indexPath)
38
+ let cell = collectionView. dequeueReusableCellWithReuseIdentifier ( ComponentsController . reuseIdentifier , forIndexPath: indexPath)
38
39
cell. contentView. addSubview ( view. render ( ) )
39
40
return cell
40
41
}
You can’t perform that action at this time.
0 commit comments