Skip to content

Commit 71b7ed2

Browse files
author
Vinodh Swamy
committed
Fixed the test failures.
1 parent 666e760 commit 71b7ed2

7 files changed

Lines changed: 13 additions & 18 deletions

File tree

VSCollectionKit/CollectionKitTestApp/AlbumsCollectionController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class AlbumsCollectionController: VSCollectionViewController {
2222

2323
override func willAddSectionControllers() {
2424
super.willAddSectionControllers()
25-
sectionHandler.addSectionHandler(handler: PhotosSectionHandler())
25+
let photSectionHandler = PhotosSectionHandler()
26+
sectionHandler.addSectionHandler(handler: photSectionHandler)
2627
}
2728

2829
override func viewDidLoad() {

VSCollectionKit/VSCollectionKit/VSCollectionViewController/VSCollectionViewDataSource.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import UIKit
1010

1111
public class VSCollectionViewDataSource: NSObject, UICollectionViewDataSource {
1212

13-
private var collectionView: UICollectionView
13+
unowned private var collectionView: UICollectionView
1414
private var data: VSCollectionViewData?
15-
private var sectionHandler: VSCollectionViewSectionHandller
15+
unowned private var sectionHandler: VSCollectionViewSectionHandller
1616
public init(collectionView: UICollectionView,
1717
sectionHandler: VSCollectionViewSectionHandller) {
1818
self.collectionView = collectionView
@@ -68,7 +68,7 @@ public class VSCollectionViewDataSource: NSObject, UICollectionViewDataSource {
6868

6969
private func handleCollectionView(collectionData: VSCollectionViewData) {
7070

71-
collectionView.performBatchUpdates({
71+
collectionView.performBatchUpdates({
7272

7373
data = collectionData
7474
let updates = collectionData.update.updates

VSCollectionKit/VSCollectionKit/VSCollectionViewController/VSCollectionViewDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import UIKit
1010

1111
public class VSCollectionViewDelegate: NSObject, UICollectionViewDelegate {
1212

13-
private var collectionView: UICollectionView
13+
unowned private var collectionView: UICollectionView
1414
public var data: VSCollectionViewData?
15-
private var sectionHandler: VSCollectionViewSectionHandller
15+
unowned private var sectionHandler: VSCollectionViewSectionHandller
1616

1717
public init(collectionView: UICollectionView,
1818
sectionHandler: VSCollectionViewSectionHandller) {

VSCollectionKit/VSCollectionKit/VSCollectionViewController/VSCollectionViewLayoutProvider.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import UIKit
1010

1111
public class VSCollectionViewLayoutProvider {
1212

13-
private var collectionView: UICollectionView
14-
private var sectionHandler: VSCollectionViewSectionHandller
13+
unowned private var collectionView: UICollectionView
14+
unowned private var sectionHandler: VSCollectionViewSectionHandller
1515
public var data: VSCollectionViewData?
1616

1717
public init(collectionView: UICollectionView,

VSCollectionKit/VSCollectionKit/VSCollectionViewController/VSCollectionViewSectionHandler.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public class VSCollectionViewSectionHandller {
1818
sectionHandlers[handler.type] = handler
1919
}
2020

21-
public func removeSectionHandler(handler: SectionHandler) {
22-
sectionHandlers[handler.type] = nil
21+
public func removeSectionHandler(type: String) {
22+
sectionHandlers[type] = nil
2323
}
2424

2525
public func registerCells(for collectionView: UICollectionView) {

VSCollectionKit/VSCollectionKit/VSCollectionViewController/VSSectionHandlerProtocol.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ public protocol SectionLayoutInfo: AnyObject {
3737
_ environment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection?
3838
}
3939

40-
//public extension SectionLayoutInfo {
41-
// func sectionLayoutProvider(_ sectionModel: SectionModel,
42-
// _ environment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection? {
43-
// return nil
44-
// }
45-
//}
46-
4740
public protocol SectionDelegateHandler: AnyObject {
4841
func didSelect(_ collectionView: UICollectionView,
4942
_ indexPath: IndexPath,

VSCollectionKit/VSCollectionKitTests/VSCollectionViewLayoutProviderTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class VSCollectionViewLayoutProviderTests: XCTestCase {
3131
func testExample() {
3232
let layoutProvider = VSCollectionViewLayoutProvider(collectionView: collectionView,
3333
sectionHandler: mockSectionHandler)
34-
XCTAssertNotNil(layoutProvider.collectionLayout(for: MockSectionModel(sectionType: "MockSection", sectionName: "Mock Section Name"),
34+
layoutProvider.data = mockCollectionViewData()
35+
XCTAssertNotNil(layoutProvider.collectionLayout(for: 0,
3536
environment: MockLayoutEnvironment()))
3637
}
3738

0 commit comments

Comments
 (0)