diff --git a/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/CollectionViewContextExtensionsTests.swift b/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/CollectionViewContextExtensionsTests.swift index 1a2a862c..3fcebf11 100644 --- a/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/CollectionViewContextExtensionsTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/CollectionViewContextExtensionsTests.swift @@ -1,16 +1,31 @@ @testable import SectionKit import XCTest -@MainActor -internal final class CollectionViewContextExtensionsTests: XCTestCase { - // MARK: - dequeueReusableCell +final class CollectionViewContextExtensionsTests: XCTestCase { + private var context: MockCollectionViewContext! - internal func testDequeueReusableCellForIndexPathWithImplicitType() { - let testExpectation = expectation(description: "Should invoke dequeueReusableCell") - let context = MockCollectionViewContext( - collectionView: UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()), + @MainActor + override func setUp() { + super.setUp() + context = MockCollectionViewContext( + collectionView: UICollectionView( + frame: .zero, + collectionViewLayout: UICollectionViewFlowLayout() + ), errorHandler: MockErrorHandler() ) + } + + override func tearDown() { + context = nil + super.tearDown() + } + + // MARK: - dequeueReusableCell + + @MainActor + func testDequeueReusableCellForIndexPathWithImplicitType() { + let testExpectation = expectation(description: "Should invoke dequeueReusableCell") context._dequeueReusableCell = { cellType, indexPath in XCTAssert(cellType === MockCollectionViewCell.self) XCTAssertEqual(indexPath, IndexPath(item: 0, section: 0)) @@ -21,12 +36,9 @@ internal final class CollectionViewContextExtensionsTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableCellForSectionIndexPathWithExplicitType() { + @MainActor + func testDequeueReusableCellForSectionIndexPathWithExplicitType() { let testExpectation = expectation(description: "Should invoke dequeueReusableCell") - let context = MockCollectionViewContext( - collectionView: UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()), - errorHandler: MockErrorHandler() - ) context._dequeueReusableCell = { cellType, indexPath in XCTAssert(cellType === MockCollectionViewCell.self) XCTAssertEqual(indexPath, IndexPath(item: 0, section: 0)) @@ -37,12 +49,9 @@ internal final class CollectionViewContextExtensionsTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableCellForSectionIndexPathWithImplicitType() { + @MainActor + func testDequeueReusableCellForSectionIndexPathWithImplicitType() { let testExpectation = expectation(description: "Should invoke dequeueReusableCell") - let context = MockCollectionViewContext( - collectionView: UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()), - errorHandler: MockErrorHandler() - ) context._dequeueReusableCell = { cellType, indexPath in XCTAssert(cellType === MockCollectionViewCell.self) XCTAssertEqual(indexPath, IndexPath(item: 0, section: 0)) @@ -55,12 +64,9 @@ internal final class CollectionViewContextExtensionsTests: XCTestCase { // MARK: - dequeueReusableHeaderView - internal func testDequeueReusableHeaderViewForIndexPathWithImplicitType() { + @MainActor + func testDequeueReusableHeaderViewForIndexPathWithImplicitType() { let testExpectation = expectation(description: "Should invoke dequeueReusableHeaderView") - let context = MockCollectionViewContext( - collectionView: UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()), - errorHandler: MockErrorHandler() - ) context._dequeueReusableHeaderView = { cellType, indexPath in XCTAssert(cellType === MockCollectionReusableView.self) XCTAssertEqual(indexPath, IndexPath(item: 0, section: 0)) @@ -71,12 +77,9 @@ internal final class CollectionViewContextExtensionsTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableHeaderViewForSectionIndexPathWithExplicitType() { + @MainActor + func testDequeueReusableHeaderViewForSectionIndexPathWithExplicitType() { let testExpectation = expectation(description: "Should invoke dequeueReusableHeaderView") - let context = MockCollectionViewContext( - collectionView: UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()), - errorHandler: MockErrorHandler() - ) context._dequeueReusableHeaderView = { cellType, indexPath in XCTAssert(cellType === MockCollectionReusableView.self) XCTAssertEqual(indexPath, IndexPath(item: 0, section: 0)) @@ -87,12 +90,9 @@ internal final class CollectionViewContextExtensionsTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableHeaderViewForSectionIndexPathWithImplicitType() { + @MainActor + func testDequeueReusableHeaderViewForSectionIndexPathWithImplicitType() { let testExpectation = expectation(description: "Should invoke dequeueReusableHeaderView") - let context = MockCollectionViewContext( - collectionView: UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()), - errorHandler: MockErrorHandler() - ) context._dequeueReusableHeaderView = { cellType, indexPath in XCTAssert(cellType === MockCollectionReusableView.self) XCTAssertEqual(indexPath, IndexPath(item: 0, section: 0)) @@ -105,12 +105,9 @@ internal final class CollectionViewContextExtensionsTests: XCTestCase { // MARK: - dequeueReusableFooterView - internal func testDequeueReusableFooterViewForIndexPathWithImplicitType() { + @MainActor + func testDequeueReusableFooterViewForIndexPathWithImplicitType() { let testExpectation = expectation(description: "Should invoke dequeueReusableFooterView") - let context = MockCollectionViewContext( - collectionView: UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()), - errorHandler: MockErrorHandler() - ) context._dequeueReusableFooterView = { cellType, indexPath in XCTAssert(cellType === MockCollectionReusableView.self) XCTAssertEqual(indexPath, IndexPath(item: 0, section: 0)) @@ -121,12 +118,9 @@ internal final class CollectionViewContextExtensionsTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableFooterViewForSectionIndexPathWithExplicitType() { + @MainActor + func testDequeueReusableFooterViewForSectionIndexPathWithExplicitType() { let testExpectation = expectation(description: "Should invoke dequeueReusableFooterView") - let context = MockCollectionViewContext( - collectionView: UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()), - errorHandler: MockErrorHandler() - ) context._dequeueReusableFooterView = { cellType, indexPath in XCTAssert(cellType === MockCollectionReusableView.self) XCTAssertEqual(indexPath, IndexPath(item: 0, section: 0)) @@ -137,12 +131,9 @@ internal final class CollectionViewContextExtensionsTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableFooterViewForSectionIndexPathWithImplicitType() { + @MainActor + func testDequeueReusableFooterViewForSectionIndexPathWithImplicitType() { let testExpectation = expectation(description: "Should invoke dequeueReusableFooterView") - let context = MockCollectionViewContext( - collectionView: UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()), - errorHandler: MockErrorHandler() - ) context._dequeueReusableFooterView = { cellType, indexPath in XCTAssert(cellType === MockCollectionReusableView.self) XCTAssertEqual(indexPath, IndexPath(item: 0, section: 0)) diff --git a/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/CollectionViewContextSizeTests.swift b/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/CollectionViewContextSizeTests.swift index 7f8e60ce..ff4d96e7 100644 --- a/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/CollectionViewContextSizeTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/CollectionViewContextSizeTests.swift @@ -1,9 +1,9 @@ @testable import SectionKit import XCTest -@MainActor -internal final class CollectionViewContextSizeTests: XCTestCase { - internal func testContainerSize() { +final class CollectionViewContextSizeTests: XCTestCase { + @MainActor + func testContainerSize() { let rect = CGRect(x: 1, y: 2, width: 4, height: 8) let collectionView = UICollectionView(frame: rect, collectionViewLayout: UICollectionViewFlowLayout()) let context = MainCollectionViewContext( @@ -14,7 +14,8 @@ internal final class CollectionViewContextSizeTests: XCTestCase { XCTAssertEqual(context.containerSize, rect.size) } - internal func testCustomContainerInset() { + @MainActor + func testCustomContainerInset() { let insets = UIEdgeInsets(top: 1, left: 2, bottom: 4, right: 8) let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) collectionView.contentInset = insets @@ -26,7 +27,8 @@ internal final class CollectionViewContextSizeTests: XCTestCase { XCTAssertEqual(context.customContainerInset, insets) } - internal func testAdjustedContainerInset() { + @MainActor + func testAdjustedContainerInset() { let insets = UIEdgeInsets(top: 1, left: 2, bottom: 4, right: 8) let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) collectionView.contentInset = insets @@ -38,7 +40,8 @@ internal final class CollectionViewContextSizeTests: XCTestCase { XCTAssertEqual(context.adjustedContainerInset, insets) } - internal func testInsetContainerSize() { + @MainActor + func testInsetContainerSize() { let rect = CGRect(x: 16, y: 32, width: 64, height: 128) let insets = UIEdgeInsets(top: 1, left: 2, bottom: 4, right: 8) let collectionView = UICollectionView(frame: rect, collectionViewLayout: UICollectionViewFlowLayout()) diff --git a/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/MainCollectionViewContextTests.swift b/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/MainCollectionViewContextTests.swift index e70c8554..94849d55 100644 --- a/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/MainCollectionViewContextTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/CollectionViewContext/MainCollectionViewContextTests.swift @@ -1,9 +1,9 @@ @testable import SectionKit import XCTest -@MainActor -internal final class MainCollectionViewContextTests: XCTestCase { - internal func testAdapterIsWeakReferenced() { +final class MainCollectionViewContextTests: XCTestCase { + @MainActor + func testAdapterIsWeakReferenced() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let context = MainCollectionViewContext( viewController: nil, @@ -16,7 +16,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { XCTAssertNil(context.adapter) } - internal func testViewControllerIsWeakReferenced() { + @MainActor + func testViewControllerIsWeakReferenced() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let context = MainCollectionViewContext( viewController: UIViewController(), @@ -26,7 +27,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { XCTAssertNil(context.viewController) } - internal func testApplySectionUpdate() { + @MainActor + func testApplySectionUpdate() { let collectionViewExpectation = expectation(description: "reloadData should be invoked") let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) collectionView._reloadData = collectionViewExpectation.fulfill @@ -52,7 +54,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testApplySectionUpdateWhenAdapterIsNotSetThenReloadDataIsCalled() { + @MainActor + func testApplySectionUpdateWhenAdapterIsNotSetThenReloadDataIsCalled() { let errorExpectation = expectation(description: "The errorHandler should be invoked") let collectionViewExpectation = expectation(description: "reloadData should be invoked") let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) @@ -78,7 +81,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testApplySectionUpdateWhenSectionControllerIsNotPartOfTheAdapterThenReloadDataIsCalled() { + @MainActor + func testApplySectionUpdateWhenSectionControllerIsNotPartOfTheAdapterThenReloadDataIsCalled() { let errorExpectation = expectation(description: "The errorHandler should be invoked") let collectionViewExpectation = expectation(description: "reloadData should be invoked") let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) @@ -106,7 +110,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableCellWhenCellIsNotRegisteredYet() { + @MainActor + func testDequeueReusableCellWhenCellIsNotRegisteredYet() { let registerExpectation = expectation(description: "The cell should be registered") let dequeueExpectation = expectation(description: "The cell should be dequeued") let mockIndexPath = IndexPath(item: 1, section: 2) @@ -137,7 +142,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableCellWhenCellIsAlreadyRegistered() { + @MainActor + func testDequeueReusableCellWhenCellIsAlreadyRegistered() { let registerExpectation = expectation(description: "The cell should not be registered") registerExpectation.fulfill() let dequeueExpectation = expectation(description: "The cell should be dequeued") @@ -168,7 +174,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableCellWhenInvalidCellIsRegistered() { + @MainActor + func testDequeueReusableCellWhenInvalidCellIsRegistered() { let errorExpectation = expectation(description: "The errorHandler should be invoked") let dequeueExpectation = expectation(description: "The cell should be dequeued") let mockIndexPath = IndexPath(item: 1, section: 2) @@ -202,7 +209,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableHeaderViewWhenHeaderViewIsNotRegisteredYet() { + @MainActor + func testDequeueReusableHeaderViewWhenHeaderViewIsNotRegisteredYet() { let registerExpectation = expectation(description: "The header view should be registered") let dequeueExpectation = expectation(description: "The header view should be dequeued") let mockIndexPath = IndexPath(item: 1, section: 2) @@ -235,7 +243,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableHeaderViewWhenHeaderViewIsAlreadyRegistered() { + @MainActor + func testDequeueReusableHeaderViewWhenHeaderViewIsAlreadyRegistered() { let registerExpectation = expectation(description: "The header view should not be registered") registerExpectation.fulfill() let dequeueExpectation = expectation(description: "The header view should be dequeued") @@ -267,7 +276,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableHeaderViewWhenInvalidHeaderViewIsRegistered() { + @MainActor + func testDequeueReusableHeaderViewWhenInvalidHeaderViewIsRegistered() { let errorExpectation = expectation(description: "The errorHandler should be invoked") let dequeueExpectation = expectation(description: "The header view should be dequeued") let mockIndexPath = IndexPath(item: 1, section: 2) @@ -302,7 +312,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableFooterViewWhenFooterViewIsNotRegisteredYet() { + @MainActor + func testDequeueReusableFooterViewWhenFooterViewIsNotRegisteredYet() { let registerExpectation = expectation(description: "The footer view should be registered") let dequeueExpectation = expectation(description: "The footer view should be dequeued") let mockIndexPath = IndexPath(item: 1, section: 2) @@ -335,7 +346,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableFooterViewWhenFooterViewIsAlreadyRegistered() { + @MainActor + func testDequeueReusableFooterViewWhenFooterViewIsAlreadyRegistered() { let registerExpectation = expectation(description: "The footer view should not be registered") registerExpectation.fulfill() let dequeueExpectation = expectation(description: "The footer view should be dequeued") @@ -367,7 +379,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testDequeueReusableFooterViewWhenInvalidFooterViewIsRegistered() { + @MainActor + func testDequeueReusableFooterViewWhenInvalidFooterViewIsRegistered() { let errorExpectation = expectation(description: "The errorHandler should be invoked") let dequeueExpectation = expectation(description: "The footer view should be dequeued") let mockIndexPath = IndexPath(item: 1, section: 2) @@ -402,7 +415,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testSectionControllerWithAdjustedIndexPath() { + @MainActor + func testSectionControllerWithAdjustedIndexPath() { let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let context = MainCollectionViewContext( viewController: nil, @@ -423,7 +437,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { XCTAssertEqual(actual?.1.indexInCollectionView, indexPath) } - internal func testSectionControllerWithAdjustedIndexPathWhenSectionDoesNotExist() { + @MainActor + func testSectionControllerWithAdjustedIndexPathWhenSectionDoesNotExist() { let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let context = MainCollectionViewContext( viewController: nil, @@ -435,7 +450,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { XCTAssertNil(context.sectionControllerWithAdjustedIndexPath(for: IndexPath(item: 0, section: 0))) } - internal func testSectionControllerWithAdjustedIndexPathWhenAdapterIsNotSet() { + @MainActor + func testSectionControllerWithAdjustedIndexPathWhenAdapterIsNotSet() { let errorExpectation = expectation(description: "The errorHandler should be invoked") let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let context = MainCollectionViewContext( @@ -454,7 +470,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testIndexOfControllerWhenAdapterIsNotSet() { + @MainActor + func testIndexOfControllerWhenAdapterIsNotSet() { let errorExpectation = expectation(description: "The errorHandler should be invoked") let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let context = MainCollectionViewContext( @@ -473,7 +490,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testIndexOfControllerThatIsNotPartOfTheContext() { + @MainActor + func testIndexOfControllerThatIsNotPartOfTheContext() { let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = MockCollectionViewAdapter() adapter._sections = { [] } @@ -486,7 +504,8 @@ internal final class MainCollectionViewContextTests: XCTestCase { XCTAssertNil(context.index(of: MockSectionController())) } - internal func testIndexOfControllerThatIsPartOfTheContext() { + @MainActor + func testIndexOfControllerThatIsPartOfTheContext() { let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let controller = MockSectionController() let adapter = MockCollectionViewAdapter() diff --git a/SectionKit/Tests/CollectionViewAdapter/ListCollectionViewAdapterTests.swift b/SectionKit/Tests/CollectionViewAdapter/ListCollectionViewAdapterTests.swift index e2edd149..9362dac9 100644 --- a/SectionKit/Tests/CollectionViewAdapter/ListCollectionViewAdapterTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/ListCollectionViewAdapterTests.swift @@ -1,11 +1,11 @@ @testable import SectionKit import XCTest -@MainActor -internal final class ListCollectionViewAdapterTests: XCTestCase { +final class ListCollectionViewAdapterTests: XCTestCase { // MARK: - Init with datasource - internal func testInitWithDataSourceSetsDataSource() { + @MainActor + func testInitWithDataSourceSetsDataSource() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [] } let adapter = ListCollectionViewAdapter( @@ -15,7 +15,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.dataSource === dataSource) } - internal func testInitWithDataSourceSetsViewController() { + @MainActor + func testInitWithDataSourceSetsViewController() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [] } let viewController = UIViewController() @@ -27,7 +28,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.context.viewController === viewController) } - internal func testInitWithDataSourceSetsScrollViewDelegate() { + @MainActor + func testInitWithDataSourceSetsScrollViewDelegate() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [] } let scrollViewDelegate = MockScrollViewDelegate() @@ -39,7 +41,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.scrollViewDelegate === scrollViewDelegate) } - internal func testInitWithDataSourceSetsErrorHandler() { + @MainActor + func testInitWithDataSourceSetsErrorHandler() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [] } let errorHandler = MockErrorHandler() @@ -51,7 +54,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.context.errorHandler is MockErrorHandler) } - internal func testInitWithDataSourceRetrievesInitialSections() { + @MainActor + func testInitWithDataSourceRetrievesInitialSections() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: MockSectionController()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [section] } @@ -63,7 +67,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.sections.first === section) } - internal func testInitWithDataSourceSetsContextOnInitialSections() { + @MainActor + func testInitWithDataSourceSetsContextOnInitialSections() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: MockSectionController()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [section] } @@ -74,7 +79,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(section.controller.context === adapter.context) } - internal func testInitWithDataSourceSetsCollectionViewDataSourceToSelf() { + @MainActor + func testInitWithDataSourceSetsCollectionViewDataSourceToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [] } let adapter = ListCollectionViewAdapter( @@ -84,8 +90,9 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dataSource === adapter) } + @MainActor @available(iOS 10.0, *) - internal func testInitWithDataSourceSetsCollectionViewDataSourcePrefetchingToSelf() { + func testInitWithDataSourceSetsCollectionViewDataSourcePrefetchingToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [] } let adapter = ListCollectionViewAdapter( @@ -95,8 +102,9 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.prefetchDataSource === adapter) } + @MainActor @available(iOS 10.0, *) - internal func testInitWithDataSourceEnablesDataSourcePrefetchingOnCollectionView() { + func testInitWithDataSourceEnablesDataSourcePrefetchingOnCollectionView() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [] } let _ = ListCollectionViewAdapter( @@ -106,7 +114,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.isPrefetchingEnabled) } - internal func testInitWithDataSourceSetsCollectionViewDelegateToSelf() { + @MainActor + func testInitWithDataSourceSetsCollectionViewDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [] } let adapter = ListCollectionViewAdapter( @@ -116,8 +125,9 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.delegate === adapter) } + @MainActor @available(iOS 11.0, *) - internal func testInitWithDataSourceSetsCollectionViewDragDelegateToSelf() { + func testInitWithDataSourceSetsCollectionViewDragDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [] } let adapter = ListCollectionViewAdapter( @@ -127,8 +137,9 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dragDelegate === adapter) } + @MainActor @available(iOS 11.0, *) - internal func testInitWithDataSourceSetsCollectionViewDropDelegateToSelf() { + func testInitWithDataSourceSetsCollectionViewDropDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [] } let adapter = ListCollectionViewAdapter( @@ -138,7 +149,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dropDelegate === adapter) } - internal func testInitWithDataSourceSetsContextAdapterToSelf() { + @MainActor + func testInitWithDataSourceSetsContextAdapterToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockListCollectionViewAdapterDataSource { _ in [] } let adapter = ListCollectionViewAdapter( @@ -150,7 +162,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { // MARK: - Init with sections - internal func testInitWithSectionsDoesNotSetDataSource() { + @MainActor + func testInitWithSectionsDoesNotSetDataSource() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter( collectionView: collectionView, @@ -159,7 +172,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssertNil(adapter.dataSource) } - internal func testInitWithSectionsSetsViewController() { + @MainActor + func testInitWithSectionsSetsViewController() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let viewController = UIViewController() let adapter = ListCollectionViewAdapter( @@ -170,7 +184,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.context.viewController === viewController) } - internal func testInitWithSectionsSetsScrollViewDelegate() { + @MainActor + func testInitWithSectionsSetsScrollViewDelegate() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let scrollViewDelegate = MockScrollViewDelegate() let adapter = ListCollectionViewAdapter( @@ -181,7 +196,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.scrollViewDelegate === scrollViewDelegate) } - internal func testInitWithSectionsSetsErrorHandler() { + @MainActor + func testInitWithSectionsSetsErrorHandler() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let errorHandler = MockErrorHandler() let adapter = ListCollectionViewAdapter( @@ -192,7 +208,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.context.errorHandler is MockErrorHandler) } - internal func testInitWithSectionsSetsInitialSections() { + @MainActor + func testInitWithSectionsSetsInitialSections() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: MockSectionController()) let adapter = ListCollectionViewAdapter( @@ -203,7 +220,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.sections.first === section) } - internal func testInitWithSectionsSetsContextOnInitialSections() { + @MainActor + func testInitWithSectionsSetsContextOnInitialSections() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: MockSectionController()) let adapter = ListCollectionViewAdapter( @@ -213,7 +231,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(section.controller.context === adapter.context) } - internal func testInitWithSectionsSetsCollectionViewDataSourceToSelf() { + @MainActor + func testInitWithSectionsSetsCollectionViewDataSourceToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter( collectionView: collectionView, @@ -222,8 +241,9 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dataSource === adapter) } + @MainActor @available(iOS 10.0, *) - internal func testInitWithSectionsSetsCollectionViewDataSourcePrefetchingToSelf() { + func testInitWithSectionsSetsCollectionViewDataSourcePrefetchingToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter( collectionView: collectionView, @@ -232,8 +252,9 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.prefetchDataSource === adapter) } + @MainActor @available(iOS 10.0, *) - internal func testInitWithSectionsEnablesDataSourcePrefetchingOnCollectionView() { + func testInitWithSectionsEnablesDataSourcePrefetchingOnCollectionView() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let _ = ListCollectionViewAdapter( collectionView: collectionView, @@ -242,7 +263,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.isPrefetchingEnabled) } - internal func testInitWithSectionsSetsCollectionViewDelegateToSelf() { + @MainActor + func testInitWithSectionsSetsCollectionViewDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter( collectionView: collectionView, @@ -251,8 +273,9 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.delegate === adapter) } + @MainActor @available(iOS 11.0, *) - internal func testInitWithSectionsSetsCollectionViewDragDelegateToSelf() { + func testInitWithSectionsSetsCollectionViewDragDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter( collectionView: collectionView, @@ -261,8 +284,9 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dragDelegate === adapter) } + @MainActor @available(iOS 11.0, *) - internal func testInitWithSectionsSetsCollectionViewDropDelegateToSelf() { + func testInitWithSectionsSetsCollectionViewDropDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter( collectionView: collectionView, @@ -271,7 +295,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dropDelegate === adapter) } - internal func testInitWithSectionsSetsContextAdapterToSelf() { + @MainActor + func testInitWithSectionsSetsContextAdapterToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter( collectionView: collectionView, @@ -282,7 +307,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { // MARK: - Weak references - internal func testDataSourceIsWeakReferenced() { + @MainActor + func testDataSourceIsWeakReferenced() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter( collectionView: collectionView, @@ -291,7 +317,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssertNil(adapter.dataSource) } - internal func testViewControllerIsWeakReferenced() { + @MainActor + func testViewControllerIsWeakReferenced() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter( collectionView: collectionView, @@ -300,7 +327,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssertNil(adapter.context.viewController) } - internal func testScrollViewDelegateIsWeakReferenced() { + @MainActor + func testScrollViewDelegateIsWeakReferenced() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter( collectionView: collectionView, @@ -311,7 +339,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { // MARK: - Setting CollectionViewSections - internal func testSetCollectionViewSectionsUpdatesContextOnSectionController() { + @MainActor + func testSetCollectionViewSectionsUpdatesContextOnSectionController() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let initialSection = Section(id: "", model: "", controller: MockSectionController()) let adapter = ListCollectionViewAdapter( @@ -324,7 +353,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(newSection.controller.context === adapter.context) } - internal func testInitialSectionsFiltersDuplicateSectionsAndInvokeErrorHandler() { + @MainActor + func testInitialSectionsFiltersDuplicateSectionsAndInvokeErrorHandler() { let testExpectation = expectation(description: "Should invoke errorHandler") let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let firstSection = Section(id: "", model: "", controller: MockSectionController()) @@ -347,7 +377,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testSectionsPropertyFiltersDuplicateSectionsAndInvokesErrorHandler() { + @MainActor + func testSectionsPropertyFiltersDuplicateSectionsAndInvokesErrorHandler() { let testExpectation = expectation(description: "Should invoke errorHandler") let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let firstSection = Section(id: "", model: "", controller: MockSectionController()) @@ -371,7 +402,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testSectionsPropertyFiltersDuplicateSectionsAndInvokesDidUpdateOnlyOnce() { + @MainActor + func testSectionsPropertyFiltersDuplicateSectionsAndInvokesDidUpdateOnlyOnce() { let didUpdateExpectation = expectation(description: "Should invoke SectionController.didUpdate exactly once") let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let sectionId = "test" @@ -408,7 +440,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testSettingTheDataSourceRetrievesTheListOfSections() { + @MainActor + func testSettingTheDataSourceRetrievesTheListOfSections() { let testExpectation = expectation(description: "Should invoke dataSource") let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: MockSectionController()) @@ -423,7 +456,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testUpdatingTheSectionsReusesSectionControllersWithTheSameId() { + @MainActor + func testUpdatingTheSectionsReusesSectionControllersWithTheSameId() { let testExpectation = expectation(description: "Should invoke didUpdate on the first SectionController") let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let firstSection = Section(id: "section", model: "1", controller: { @@ -448,7 +482,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testUpdatingTheSectionsCalculatesAnUpdate() { + @MainActor + func testUpdatingTheSectionsCalculatesAnUpdate() { let testExpectation = expectation(description: "Should invoke calculateUpdate on the adapter") let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let firstSection = Section(id: "section", model: "1", controller: { @@ -491,7 +526,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testCallingInvalidateDataSourceRetrievesTheListOfSections() { + @MainActor + func testCallingInvalidateDataSourceRetrievesTheListOfSections() { let testExpectation = expectation(description: "Should invoke dataSource") testExpectation.expectedFulfillmentCount = 2 let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) @@ -512,7 +548,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testResettingDataSourceDoesNotRetrieveTheListOfSectionsAgain() { + @MainActor + func testResettingDataSourceDoesNotRetrieveTheListOfSectionsAgain() { let testExpectation = expectation(description: "Should invoke dataSource") let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: { @@ -534,7 +571,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { // MARK: - calculateUpdate - internal func testCalculateUpdateReloadsData() throws { + @MainActor + func testCalculateUpdateReloadsData() throws { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter(collectionView: collectionView) let update = try XCTUnwrap(adapter.calculateUpdate(from: [], to: [])) @@ -547,7 +585,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(update.shouldReload(batchOperation)) } - internal func testCalculateUpdateHasCorrectData() throws { + @MainActor + func testCalculateUpdateHasCorrectData() throws { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter(collectionView: collectionView) let section = Section(id: "1", model: "", controller: MockSectionController()) @@ -563,7 +602,8 @@ internal final class ListCollectionViewAdapterTests: XCTestCase { XCTAssert(batchOperation.data.first === section) } - internal func testCalculateUpdateSetDataSetsCollectionViewSection() throws { + @MainActor + func testCalculateUpdateSetDataSetsCollectionViewSection() throws { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = ListCollectionViewAdapter(collectionView: collectionView) let section = Section(id: "1", model: "", controller: MockSectionController()) diff --git a/SectionKit/Tests/CollectionViewAdapter/SingleSectionCollectionViewAdapterTests.swift b/SectionKit/Tests/CollectionViewAdapter/SingleSectionCollectionViewAdapterTests.swift index f4308b60..6220c34e 100644 --- a/SectionKit/Tests/CollectionViewAdapter/SingleSectionCollectionViewAdapterTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/SingleSectionCollectionViewAdapterTests.swift @@ -1,11 +1,11 @@ @testable import SectionKit import XCTest -@MainActor -internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { +final class SingleSectionCollectionViewAdapterTests: XCTestCase { // MARK: - Init with datasource - internal func testInitWithDataSourceSetsDataSource() { + @MainActor + func testInitWithDataSourceSetsDataSource() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in nil } let adapter = SingleSectionCollectionViewAdapter( @@ -15,7 +15,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.dataSource === dataSource) } - internal func testInitWithDataSourceSetsViewController() { + @MainActor + func testInitWithDataSourceSetsViewController() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in nil } let viewController = UIViewController() @@ -27,7 +28,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.context.viewController === viewController) } - internal func testInitWithDataSourceSetsScrollViewDelegate() { + @MainActor + func testInitWithDataSourceSetsScrollViewDelegate() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in nil } let scrollViewDelegate = MockScrollViewDelegate() @@ -39,7 +41,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.scrollViewDelegate === scrollViewDelegate) } - internal func testInitWithDataSourceSetsErrorHandler() { + @MainActor + func testInitWithDataSourceSetsErrorHandler() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in nil } let errorHandler = MockErrorHandler() @@ -51,7 +54,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.context.errorHandler is MockErrorHandler) } - internal func testInitWithDataSourceRetrievesInitialSections() { + @MainActor + func testInitWithDataSourceRetrievesInitialSections() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: MockSectionController()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in section } @@ -63,7 +67,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.sections.first === section) } - internal func testInitWithDataSourceSetsContextOnInitialSections() { + @MainActor + func testInitWithDataSourceSetsContextOnInitialSections() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: MockSectionController()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in section } @@ -74,7 +79,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(section.controller.context === adapter.context) } - internal func testInitWithDataSourceSetsCollectionViewDataSourceToSelf() { + @MainActor + func testInitWithDataSourceSetsCollectionViewDataSourceToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in nil } let adapter = SingleSectionCollectionViewAdapter( @@ -84,8 +90,9 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dataSource === adapter) } + @MainActor @available(iOS 10.0, *) - internal func testInitWithDataSourceSetsCollectionViewDataSourcePrefetchingToSelf() { + func testInitWithDataSourceSetsCollectionViewDataSourcePrefetchingToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in nil } let adapter = SingleSectionCollectionViewAdapter( @@ -95,8 +102,9 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.prefetchDataSource === adapter) } + @MainActor @available(iOS 10.0, *) - internal func testInitWithDataSourceEnablesDataSourcePrefetchingOnCollectionView() { + func testInitWithDataSourceEnablesDataSourcePrefetchingOnCollectionView() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in nil } let _ = SingleSectionCollectionViewAdapter( @@ -106,7 +114,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.isPrefetchingEnabled) } - internal func testInitWithDataSourceSetsCollectionViewDelegateToSelf() { + @MainActor + func testInitWithDataSourceSetsCollectionViewDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in nil } let adapter = SingleSectionCollectionViewAdapter( @@ -116,8 +125,9 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.delegate === adapter) } + @MainActor @available(iOS 11.0, *) - internal func testInitWithDataSourceSetsCollectionViewDragDelegateToSelf() { + func testInitWithDataSourceSetsCollectionViewDragDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in nil } let adapter = SingleSectionCollectionViewAdapter( @@ -127,8 +137,9 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dragDelegate === adapter) } + @MainActor @available(iOS 11.0, *) - internal func testInitWithDataSourceSetsCollectionViewDropDelegateToSelf() { + func testInitWithDataSourceSetsCollectionViewDropDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in nil } let adapter = SingleSectionCollectionViewAdapter( @@ -138,7 +149,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dropDelegate === adapter) } - internal func testInitWithDataSourceSetsContextAdapterToSelf() { + @MainActor + func testInitWithDataSourceSetsContextAdapterToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let dataSource = MockSingleSectionCollectionViewAdapterDataSource { _ in nil } let adapter = SingleSectionCollectionViewAdapter( @@ -150,7 +162,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { // MARK: - Init with sections - internal func testInitWithSectionsDoesNotSetDataSource() { + @MainActor + func testInitWithSectionsDoesNotSetDataSource() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -159,7 +172,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssertNil(adapter.dataSource) } - internal func testInitWithSectionsSetsViewController() { + @MainActor + func testInitWithSectionsSetsViewController() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let viewController = UIViewController() let adapter = SingleSectionCollectionViewAdapter( @@ -170,7 +184,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.context.viewController === viewController) } - internal func testInitWithSectionsSetsScrollViewDelegate() { + @MainActor + func testInitWithSectionsSetsScrollViewDelegate() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let scrollViewDelegate = MockScrollViewDelegate() let adapter = SingleSectionCollectionViewAdapter( @@ -181,7 +196,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.scrollViewDelegate === scrollViewDelegate) } - internal func testInitWithSectionsSetsErrorHandler() { + @MainActor + func testInitWithSectionsSetsErrorHandler() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let errorHandler = MockErrorHandler() let adapter = SingleSectionCollectionViewAdapter( @@ -192,7 +208,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.context.errorHandler is MockErrorHandler) } - internal func testInitWithSectionsSetsInitialSections() { + @MainActor + func testInitWithSectionsSetsInitialSections() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: MockSectionController()) let adapter = SingleSectionCollectionViewAdapter( @@ -203,7 +220,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.sections.first === section) } - internal func testInitWithSectionsSetsContextOnInitialSections() { + @MainActor + func testInitWithSectionsSetsContextOnInitialSections() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: MockSectionController()) let adapter = SingleSectionCollectionViewAdapter( @@ -213,7 +231,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(section.controller.context === adapter.context) } - internal func testInitWithSectionsSetsCollectionViewDataSourceToSelf() { + @MainActor + func testInitWithSectionsSetsCollectionViewDataSourceToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -222,8 +241,9 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dataSource === adapter) } + @MainActor @available(iOS 10.0, *) - internal func testInitWithSectionsSetsCollectionViewDataSourcePrefetchingToSelf() { + func testInitWithSectionsSetsCollectionViewDataSourcePrefetchingToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -232,8 +252,9 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.prefetchDataSource === adapter) } + @MainActor @available(iOS 10.0, *) - internal func testInitWithSectionsEnablesDataSourcePrefetchingOnCollectionView() { + func testInitWithSectionsEnablesDataSourcePrefetchingOnCollectionView() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let _ = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -242,7 +263,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.isPrefetchingEnabled) } - internal func testInitWithSectionsSetsCollectionViewDelegateToSelf() { + @MainActor + func testInitWithSectionsSetsCollectionViewDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -251,8 +273,9 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.delegate === adapter) } + @MainActor @available(iOS 11.0, *) - internal func testInitWithSectionsSetsCollectionViewDragDelegateToSelf() { + func testInitWithSectionsSetsCollectionViewDragDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -261,8 +284,9 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dragDelegate === adapter) } + @MainActor @available(iOS 11.0, *) - internal func testInitWithSectionsSetsCollectionViewDropDelegateToSelf() { + func testInitWithSectionsSetsCollectionViewDropDelegateToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -271,7 +295,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(collectionView.dropDelegate === adapter) } - internal func testInitWithSectionsSetsContextAdapterToSelf() { + @MainActor + func testInitWithSectionsSetsContextAdapterToSelf() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -282,7 +307,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { // MARK: - Weak references - internal func testDataSourceIsWeakReferenced() { + @MainActor + func testDataSourceIsWeakReferenced() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -291,7 +317,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssertNil(adapter.dataSource) } - internal func testViewControllerIsWeakReferenced() { + @MainActor + func testViewControllerIsWeakReferenced() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -300,7 +327,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssertNil(adapter.context.viewController) } - internal func testScrollViewDelegateIsWeakReferenced() { + @MainActor + func testScrollViewDelegateIsWeakReferenced() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -311,7 +339,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { // MARK: - Setting CollectionViewSections - internal func testSetCollectionViewSectionsUpdatesContextOnSectionController() { + @MainActor + func testSetCollectionViewSectionsUpdatesContextOnSectionController() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let initialSection = Section(id: "", model: "", controller: MockSectionController()) let adapter = SingleSectionCollectionViewAdapter( @@ -324,7 +353,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(newSection.controller.context === adapter.context) } - internal func testSettingTheDataSourceRetrievesTheSection() { + @MainActor + func testSettingTheDataSourceRetrievesTheSection() { let testExpectation = expectation(description: "Should invoke dataSource") let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: MockSectionController()) @@ -339,7 +369,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testUpdatingTheSectionsReusesSectionControllersWithTheSameId() { + @MainActor + func testUpdatingTheSectionsReusesSectionControllersWithTheSameId() { let testExpectation = expectation(description: "Should invoke didUpdate on the first SectionController") let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let firstSection = Section(id: "section", model: "1", controller: { @@ -364,7 +395,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testUpdatingTheSectionsCalculatesAnUpdate() { + @MainActor + func testUpdatingTheSectionsCalculatesAnUpdate() { let testExpectation = expectation(description: "Should invoke calculateUpdate on the adapter") let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let firstSection = Section(id: "section", model: "1", controller: { @@ -405,7 +437,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testCallingInvalidateDataSourceRetrievesTheSection() { + @MainActor + func testCallingInvalidateDataSourceRetrievesTheSection() { let testExpectation = expectation(description: "Should invoke dataSource") testExpectation.expectedFulfillmentCount = 2 let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) @@ -426,7 +459,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testResettingDataSourceDoesNotRetrieveTheSectionAgain() { + @MainActor + func testResettingDataSourceDoesNotRetrieveTheSectionAgain() { let testExpectation = expectation(description: "Should invoke dataSource") let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: { @@ -446,7 +480,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testSectionsWhenThereIsASection() { + @MainActor + func testSectionsWhenThereIsASection() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let section = Section(id: "", model: "", controller: MockSectionController()) let adapter = SingleSectionCollectionViewAdapter( @@ -457,7 +492,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(adapter.sections.first === section) } - internal func testSectionsWhenThereIsNoSection() { + @MainActor + func testSectionsWhenThereIsNoSection() { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter( collectionView: collectionView, @@ -468,7 +504,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { // MARK: - calculateUpdate - internal func testCalculateUpdateFromSomeToSomeWithTheSameId() throws { + @MainActor + func testCalculateUpdateFromSomeToSomeWithTheSameId() throws { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter(collectionView: collectionView) let update = try XCTUnwrap( @@ -486,7 +523,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssertFalse(update.shouldReload(batchOperation)) } - internal func testCalculateUpdateFromSomeToSomeWithADifferentId() throws { + @MainActor + func testCalculateUpdateFromSomeToSomeWithADifferentId() throws { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter(collectionView: collectionView) let update = try XCTUnwrap( @@ -504,7 +542,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssertFalse(update.shouldReload(batchOperation)) } - internal func testCalculateUpdateFromNoneToSome() throws { + @MainActor + func testCalculateUpdateFromNoneToSome() throws { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter(collectionView: collectionView) let update = try XCTUnwrap( @@ -522,7 +561,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssertFalse(update.shouldReload(batchOperation)) } - internal func testCalculateUpdateFromSomeToNone() throws { + @MainActor + func testCalculateUpdateFromSomeToNone() throws { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter(collectionView: collectionView) let update = try XCTUnwrap( @@ -540,7 +580,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssertFalse(update.shouldReload(batchOperation)) } - internal func testCalculateUpdateFromNoneToNone() throws { + @MainActor + func testCalculateUpdateFromNoneToNone() throws { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter(collectionView: collectionView) let update = try XCTUnwrap(adapter.calculateUpdate(from: nil, to: nil)) @@ -553,7 +594,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssertFalse(update.shouldReload(batchOperation)) } - internal func testCalculateUpdateHasCorrectData() throws { + @MainActor + func testCalculateUpdateHasCorrectData() throws { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter(collectionView: collectionView) let section = Section(id: "1", model: "", controller: MockSectionController()) @@ -568,7 +610,8 @@ internal final class SingleSectionCollectionViewAdapterTests: XCTestCase { XCTAssert(batchOperation.data === section) } - internal func testCalculateUpdateSetDataSetsCollectionViewSection() throws { + @MainActor + func testCalculateUpdateSetDataSetsCollectionViewSection() throws { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let adapter = SingleSectionCollectionViewAdapter(collectionView: collectionView) let section = Section(id: "1", model: "", controller: MockSectionController()) diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/BaseCollectionViewAdapterUICollectionViewDataSourceTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/BaseCollectionViewAdapterUICollectionViewDataSourceTests.swift index 43213c35..c13c7739 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/BaseCollectionViewAdapterUICollectionViewDataSourceTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/BaseCollectionViewAdapterUICollectionViewDataSourceTests.swift @@ -2,27 +2,27 @@ import UIKit import XCTest -@MainActor -internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestCase { +class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseCollectionViewAdapterUICollectionViewDataSourceTests.self else { return } throw XCTSkip("Tests from base class are skipped") } - internal func createCollectionView( + func createCollectionView( frame: CGRect = .zero, collectionViewLayout layout: UICollectionViewLayout? = nil ) -> UICollectionView { UICollectionView(frame: frame, collectionViewLayout: layout ?? UICollectionViewFlowLayout()) } - internal func createCollectionViewAdapter( + @MainActor + func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, @@ -32,7 +32,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC throw XCTSkip("Tests from base class are skipped") } - internal func testNumberOfSections() throws { + @MainActor + func testNumberOfSections() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -43,7 +44,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC XCTAssertEqual(adapter.numberOfSections?(in: collectionView), 1) } - internal func testNumberOfItemsInSection() throws { + @MainActor + func testNumberOfItemsInSection() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -62,7 +64,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC XCTAssertEqual(adapter.collectionView(collectionView, numberOfItemsInSection: 0), 1) } - internal func testNumberOfItemsInSectionWithInvalidIndex() throws { + @MainActor + func testNumberOfItemsInSectionWithInvalidIndex() throws { let testExpectation = expectation(description: "Should invoke errorHandler") let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( @@ -91,7 +94,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC waitForExpectations(timeout: 1) } - internal func testCellForItem() throws { + @MainActor + func testCellForItem() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -118,7 +122,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC ) } - internal func testCellForItemWithInvalidSectionIndex() throws { + @MainActor + func testCellForItemWithInvalidSectionIndex() throws { let testExpectation = expectation(description: "Should invoke errorHandler") let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( @@ -155,7 +160,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC waitForExpectations(timeout: 1) } - internal func testCellForItemWithInvalidIndexPath() throws { + @MainActor + func testCellForItemWithInvalidIndexPath() throws { let testExpectation = expectation(description: "Should invoke errorHandler") let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( @@ -192,7 +198,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC waitForExpectations(timeout: 1) } - internal func testViewForSupplementaryElementOfKindHeader() throws { + @MainActor + func testViewForSupplementaryElementOfKindHeader() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -219,7 +226,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC ) } - internal func testViewForSupplementaryElementOfKindWithInvalidSectionIndex() throws { + @MainActor + func testViewForSupplementaryElementOfKindWithInvalidSectionIndex() throws { let testExpectation = expectation(description: "Should invoke errorHandler") let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( @@ -256,7 +264,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC waitForExpectations(timeout: 1) } - internal func testViewForSupplementaryElementOfKindWithInvalidIndexPath() throws { + @MainActor + func testViewForSupplementaryElementOfKindWithInvalidIndexPath() throws { let testExpectation = expectation(description: "Should invoke errorHandler") let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( @@ -293,7 +302,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC waitForExpectations(timeout: 1) } - internal func testViewForSupplementaryElementOfKindFooter() throws { + @MainActor + func testViewForSupplementaryElementOfKindFooter() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -320,7 +330,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC ) } - internal func testViewForSupplementaryElementOfKindWithUnsupportedElementKind() throws { + @MainActor + func testViewForSupplementaryElementOfKindWithUnsupportedElementKind() throws { let testExpectation = expectation(description: "Should invoke errorHandler") let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( @@ -357,7 +368,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC waitForExpectations(timeout: 1) } - internal func testCanMoveItemAt() throws { + @MainActor + func testCanMoveItemAt() throws { let testExpectation = expectation(description: "Should invoke datasource") let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( @@ -381,7 +393,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC waitForExpectations(timeout: 1) } - internal func testMoveItemInSameSectionCallsDataSource() throws { + @MainActor + func testMoveItemInSameSectionCallsDataSource() throws { let testExpectation = expectation(description: "Should invoke datasource") let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( @@ -408,7 +421,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC waitForExpectations(timeout: 1) } - internal func testMoveItemInDifferentSectionNotCallsDataSource() throws { + @MainActor + func testMoveItemInDifferentSectionNotCallsDataSource() throws { let dataSourceExpectation = expectation(description: "Should not invoke datasource") dataSourceExpectation.fulfill() let errorExpectation = expectation(description: "Should invoke errorHandler") @@ -448,7 +462,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC waitForExpectations(timeout: 1) } - internal func testMoveItemWithInvalidSourceIndexPath() throws { + @MainActor + func testMoveItemWithInvalidSourceIndexPath() throws { let testExpectation = expectation(description: "Should invoke errorHandler") let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( @@ -470,7 +485,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC waitForExpectations(timeout: 1) } - internal func testMoveItemWithInvalidDestinationIndexPath() throws { + @MainActor + func testMoveItemWithInvalidDestinationIndexPath() throws { let testExpectation = expectation(description: "Should invoke errorHandler") let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( @@ -492,15 +508,17 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourceTests: XCTestC waitForExpectations(timeout: 1) } + @MainActor @available(iOS 14.0, *) - internal func testIndexTitlesIsNil() throws { + func testIndexTitlesIsNil() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter(collectionView: collectionView) XCTAssertNil(adapter.indexTitles?(for: collectionView)) } + @MainActor @available(iOS 14.0, *) - internal func testIndexPathForIndexTitle() throws { + func testIndexPathForIndexTitle() throws { let testExpectation = expectation(description: "Should invoke errorHandler") let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/ListCollectionViewAdapterUICollectionViewDataSourceTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/ListCollectionViewAdapterUICollectionViewDataSourceTests.swift index 421c30ae..c293fd07 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/ListCollectionViewAdapterUICollectionViewDataSourceTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/ListCollectionViewAdapterUICollectionViewDataSourceTests.swift @@ -2,9 +2,9 @@ import UIKit import XCTest -@MainActor -internal final class ListCollectionViewAdapterUICollectionViewDataSourceTests: BaseCollectionViewAdapterUICollectionViewDataSourceTests { - override internal func createCollectionViewAdapter( +final class ListCollectionViewAdapterUICollectionViewDataSourceTests: BaseCollectionViewAdapterUICollectionViewDataSourceTests { + @MainActor + override func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/SingleSectionCollectionViewAdapterUICollectionViewDataSourceTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/SingleSectionCollectionViewAdapterUICollectionViewDataSourceTests.swift index 388bb14a..077b35df 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/SingleSectionCollectionViewAdapterUICollectionViewDataSourceTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSource/SingleSectionCollectionViewAdapterUICollectionViewDataSourceTests.swift @@ -2,8 +2,8 @@ import UIKit import XCTest -@MainActor -internal final class SingleSectionCollectionViewAdapterUICollectionViewDataSourceTests: BaseCollectionViewAdapterUICollectionViewDataSourceTests { +final class SingleSectionCollectionViewAdapterUICollectionViewDataSourceTests: BaseCollectionViewAdapterUICollectionViewDataSourceTests { + @MainActor override internal func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift index 8d390447..c6c44abc 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift @@ -2,28 +2,28 @@ import UIKit import XCTest -@MainActor @available(iOS 10.0, *) -internal class BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests: XCTestCase { +class BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.self else { return } throw XCTSkip("Tests from base class are skipped") } - internal func createCollectionView( + func createCollectionView( frame: CGRect = .zero, collectionViewLayout layout: UICollectionViewLayout? = nil ) -> UICollectionView { UICollectionView(frame: frame, collectionViewLayout: layout ?? UICollectionViewFlowLayout()) } - internal func createCollectionViewAdapter( + @MainActor + func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, @@ -33,7 +33,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTes throw XCTSkip("Tests from base class are skipped") } - internal func testPrefetchItems() throws { + @MainActor + func testPrefetchItems() throws { let testExpectation = expectation(description: "Should invoke datasource prefetching delegate") let collectionView = createCollectionView() let itemsToPrefetch = [IndexPath(item: 0, section: 0), IndexPath(item: 1, section: 0)] @@ -58,7 +59,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTes waitForExpectations(timeout: 1) } - internal func testPrefetchItemsWithInvalidIndices() throws { + @MainActor + func testPrefetchItemsWithInvalidIndices() throws { let testExpectation = expectation(description: "Should invoke datasource prefetching delegate") let collectionView = createCollectionView() let itemsToPrefetch = [IndexPath(item: 0, section: 0), IndexPath(item: 1, section: 0)] @@ -84,7 +86,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTes waitForExpectations(timeout: 1) } - internal func testCancelPrefetchingForItems() throws { + @MainActor + func testCancelPrefetchingForItems() throws { let testExpectation = expectation(description: "Should invoke datasource prefetching delegate") let collectionView = createCollectionView() let itemsToCancel = [IndexPath(item: 0, section: 0), IndexPath(item: 1, section: 0)] @@ -109,7 +112,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTes waitForExpectations(timeout: 1) } - internal func testCancelPrefetchingForItemsWithInvalidIndices() throws { + @MainActor + func testCancelPrefetchingForItemsWithInvalidIndices() throws { let testExpectation = expectation(description: "Should invoke datasource prefetching delegate") let collectionView = createCollectionView() let itemsToCancel = [IndexPath(item: 0, section: 0), IndexPath(item: 1, section: 0)] diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/ListCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/ListCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift index 3907afb9..e60cb041 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/ListCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/ListCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift @@ -2,10 +2,10 @@ import UIKit import XCTest -@MainActor @available(iOS 10.0, *) -internal final class ListCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests: BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests { - override internal func createCollectionViewAdapter( +final class ListCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests: BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests { + @MainActor + override func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/SingleSectionCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/SingleSectionCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift index 4771a11b..5e0af08b 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/SingleSectionCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDataSourcePrefetching/SingleSectionCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests.swift @@ -2,10 +2,10 @@ import UIKit import XCTest -@MainActor @available(iOS 10.0, *) -internal final class SingleSectionCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests: BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests { - override internal func createCollectionViewAdapter( +final class SingleSectionCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests: BaseCollectionViewAdapterUICollectionViewDataSourcePrefetchingTests { + @MainActor + override func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/BaseCollectionViewAdapterUICollectionViewDelegateTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/BaseCollectionViewAdapterUICollectionViewDelegateTests.swift index 5ca88825..612b8407 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/BaseCollectionViewAdapterUICollectionViewDelegateTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/BaseCollectionViewAdapterUICollectionViewDelegateTests.swift @@ -2,27 +2,27 @@ import UIKit import XCTest -@MainActor -internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCase { +class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseCollectionViewAdapterUICollectionViewDelegateTests.self else { return } throw XCTSkip("Tests from base class are skipped") } - internal func createCollectionView( + func createCollectionView( frame: CGRect = .zero, collectionViewLayout layout: UICollectionViewLayout? = nil ) -> UICollectionView { UICollectionView(frame: frame, collectionViewLayout: layout ?? UICollectionViewFlowLayout()) } - internal func createCollectionViewAdapter( + @MainActor + func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, @@ -32,7 +32,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas throw XCTSkip("Tests from base class are skipped") } - internal func testShouldHighlightItem() throws { + @MainActor + func testShouldHighlightItem() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -61,7 +62,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testShouldHighlightItemWithoutDelegate() throws { + @MainActor + func testShouldHighlightItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let adapter = try createCollectionViewAdapter( @@ -80,7 +82,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } - internal func testDidHighlightItem() throws { + @MainActor + func testDidHighlightItem() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -105,7 +108,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testDidHighlightItemWithoutDelegate() throws { + @MainActor + func testDidHighlightItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let adapter = try createCollectionViewAdapter( @@ -121,7 +125,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas adapter.collectionView?(collectionView, didHighlightItemAt: itemIndexPath.indexInCollectionView) } - internal func testDidUnhighlightItem() throws { + @MainActor + func testDidUnhighlightItem() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -146,7 +151,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testDidUnhighlightItemWithoutDelegate() throws { + @MainActor + func testDidUnhighlightItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let adapter = try createCollectionViewAdapter( @@ -162,7 +168,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas adapter.collectionView?(collectionView, didUnhighlightItemAt: itemIndexPath.indexInCollectionView) } - internal func testShouldSelectItem() throws { + @MainActor + func testShouldSelectItem() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -191,7 +198,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testShouldSelectItemWithoutDelegate() throws { + @MainActor + func testShouldSelectItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let adapter = try createCollectionViewAdapter( @@ -210,7 +218,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } - internal func testShouldDeselectItem() throws { + @MainActor + func testShouldDeselectItem() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -239,7 +248,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testShouldDeselectItemWithoutDelegate() throws { + @MainActor + func testShouldDeselectItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let adapter = try createCollectionViewAdapter( @@ -258,7 +268,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } - internal func testDidSelectItem() throws { + @MainActor + func testDidSelectItem() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -283,7 +294,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testDidSelectItemWithoutDelegate() throws { + @MainActor + func testDidSelectItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let adapter = try createCollectionViewAdapter( @@ -299,7 +311,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas adapter.collectionView?(collectionView, didSelectItemAt: itemIndexPath.indexInCollectionView) } - internal func testDidDeselectItem() throws { + @MainActor + func testDidDeselectItem() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -324,7 +337,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testDidDeselectItemWithoutDelegate() throws { + @MainActor + func testDidDeselectItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let adapter = try createCollectionViewAdapter( @@ -340,7 +354,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas adapter.collectionView?(collectionView, didDeselectItemAt: itemIndexPath.indexInCollectionView) } - internal func testWillDisplayCell() throws { + @MainActor + func testWillDisplayCell() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -367,7 +382,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testWillDisplayCellWithoutDelegate() throws { + @MainActor + func testWillDisplayCellWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let itemCell = MockCollectionViewCell() @@ -384,7 +400,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas adapter.collectionView?(collectionView, willDisplay: itemCell, forItemAt: itemIndexPath.indexInCollectionView) } - internal func testWillDisplayHeaderView() throws { + @MainActor + func testWillDisplayHeaderView() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -416,7 +433,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testWillDisplayFooterView() throws { + @MainActor + func testWillDisplayFooterView() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -448,7 +466,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testWillDisplaySupplementaryViewWithoutDelegate() throws { + @MainActor + func testWillDisplaySupplementaryViewWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let itemHeaderView = MockCollectionReusableView() @@ -470,7 +489,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } - internal func testWillDisplaySupplementaryViewWithInvalidElementKind() throws { + @MainActor + func testWillDisplaySupplementaryViewWithInvalidElementKind() throws { let delegateExpectation = expectation(description: "Should not invoke delegate") delegateExpectation.fulfill() let errorExpectation = expectation(description: "Should invoke errorHandler") @@ -513,7 +533,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testDidEndDisplayingCell() throws { + @MainActor + func testDidEndDisplayingCell() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -540,7 +561,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testDidEndDisplayingCellWithoutDelegate() throws { + @MainActor + func testDidEndDisplayingCellWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let itemCell = MockCollectionViewCell() @@ -557,7 +579,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas adapter.collectionView?(collectionView, didEndDisplaying: itemCell, forItemAt: itemIndexPath.indexInCollectionView) } - internal func testDidEndDisplayingHeaderView() throws { + @MainActor + func testDidEndDisplayingHeaderView() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -589,7 +612,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testDidEndDisplayingFooterView() throws { + @MainActor + func testDidEndDisplayingFooterView() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -621,7 +645,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testDidEndDisplayingSupplementaryViewWithoutDelegate() throws { + @MainActor + func testDidEndDisplayingSupplementaryViewWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let itemHeaderView = MockCollectionReusableView() @@ -643,7 +668,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } - internal func testDidEndDisplayingSupplementaryWithInvalidElementKind() throws { + @MainActor + func testDidEndDisplayingSupplementaryWithInvalidElementKind() throws { let delegateExpectation = expectation(description: "Should not invoke delegate") delegateExpectation.fulfill() let errorExpectation = expectation(description: "Should invoke errorHandler") @@ -687,8 +713,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas } // availability attribute is needed because of deprecation warning + @MainActor @available(iOS, introduced: 6.0, deprecated: 13.0) - internal func testShouldShowMenuForItem() throws { + func testShouldShowMenuForItem() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -718,8 +745,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas } // availability attribute is needed because of deprecation warning + @MainActor @available(iOS, introduced: 6.0, deprecated: 13.0) - internal func testShouldShowMenuForItemWithoutDelegate() throws { + func testShouldShowMenuForItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let adapter = try createCollectionViewAdapter( @@ -739,8 +767,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas } // availability attribute is needed because of deprecation warning + @MainActor @available(iOS, introduced: 6.0, deprecated: 13.0) - internal func testCanPerform() throws { + func testCanPerform() throws { class Mock { @objc func perform() { } @@ -782,8 +811,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas } // availability attribute is needed because of deprecation warning + @MainActor @available(iOS, introduced: 6.0, deprecated: 13.0) - internal func testCanPerformWithoutDelegate() throws { + func testCanPerformWithoutDelegate() throws { class Mock { @objc func perform() { } @@ -813,8 +843,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas } // availability attribute is needed because of deprecation warning + @MainActor @available(iOS, introduced: 6.0, deprecated: 13.0) - internal func testPerform() throws { + func testPerform() throws { class Mock { @objc func perform() { } @@ -852,8 +883,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas } // availability attribute is needed because of deprecation warning + @MainActor @available(iOS, introduced: 6.0, deprecated: 13.0) - internal func testPerformWithoutDelegate() throws { + func testPerformWithoutDelegate() throws { class Mock { @objc func perform() { } @@ -879,7 +911,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } - internal func testTransitionLayoutForOldLayout() throws { + @MainActor + func testTransitionLayoutForOldLayout() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -900,7 +933,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas XCTAssert(transitionLayout.nextLayout === toLayout) } - internal func testCanFocusItem() throws { + @MainActor + func testCanFocusItem() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -929,7 +963,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } - internal func testCanFocusItemWithoutDelegate() throws { + @MainActor + func testCanFocusItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let adapter = try createCollectionViewAdapter( @@ -949,7 +984,7 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas } // Not possible to instantiate `UICollectionViewFocusUpdateContext` -// internal func testShouldUpdateFocus() throws { +// func testShouldUpdateFocus() throws { // let collectionView = createCollectionView() // let adapter = try createCollectionViewAdapter( // collectionView: collectionView, @@ -964,7 +999,7 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas // } // Not possible to instantiate `UICollectionViewFocusUpdateContext` -// internal func testDidUpdateFocus() throws { +// func testDidUpdateFocus() throws { // let collectionView = createCollectionView() // let adapter = try createCollectionViewAdapter( // collectionView: collectionView, @@ -979,7 +1014,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas // ) // } - internal func testIndexPathForPreferredFocusedView() throws { + @MainActor + func testIndexPathForPreferredFocusedView() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -990,7 +1026,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas XCTAssertNil(adapter.indexPathForPreferredFocusedView?(in: collectionView)) } - internal func testTargetIndexPathForMoveFromItem() throws { + @MainActor + func testTargetIndexPathForMoveFromItem() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -1010,7 +1047,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } - internal func testTargetContentOffsetForProposedContentOffset() throws { + @MainActor + func testTargetContentOffsetForProposedContentOffset() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -1028,8 +1066,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } + @MainActor @available(iOS 11.0, *) - internal func testShouldSpringLoadItem() throws { + func testShouldSpringLoadItem() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -1064,8 +1103,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } + @MainActor @available(iOS 11.0, *) - internal func testShouldSpringLoadItemWithoutDelegate() throws { + func testShouldSpringLoadItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let mockContext = MockSpringLoadedInteractionContext() @@ -1089,8 +1129,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } + @MainActor @available(iOS 13.0, *) - internal func testShouldBeginMultipleSelectionInteraction() throws { + func testShouldBeginMultipleSelectionInteraction() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -1122,8 +1163,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } + @MainActor @available(iOS 13.0, *) - internal func testShouldBeginMultipleSelectionInteractionWithoutDelegate() throws { + func testShouldBeginMultipleSelectionInteractionWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let adapter = try createCollectionViewAdapter( @@ -1145,8 +1187,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } + @MainActor @available(iOS 13.0, *) - internal func testDidBeginMultipleSelectionInteraction() throws { + func testDidBeginMultipleSelectionInteraction() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -1174,8 +1217,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } + @MainActor @available(iOS 13.0, *) - internal func testDidBeginMultipleSelectionInteractionWithoutDelegate() throws { + func testDidBeginMultipleSelectionInteractionWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let adapter = try createCollectionViewAdapter( @@ -1194,8 +1238,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } + @MainActor @available(iOS 13.0, *) - internal func testDidEndMultipleSelectionInteraction() throws { + func testDidEndMultipleSelectionInteraction() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -1206,8 +1251,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas adapter.collectionViewDidEndMultipleSelectionInteraction?(collectionView) } + @MainActor @available(iOS 13.0, *) - internal func testContextMenuConfigurationForItem() throws { + func testContextMenuConfigurationForItem() throws { let testExpectation = expectation(description: "Should invoke delegate") let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) @@ -1242,8 +1288,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas waitForExpectations(timeout: 1) } + @MainActor @available(iOS 13.0, *) - internal func testContextMenuConfigurationForItemWithoutDelegate() throws { + func testContextMenuConfigurationForItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = SectionIndexPath(IndexPath(item: 0, section: 0)) let itemPoint = CGPoint(x: 1, y: 2) @@ -1266,8 +1313,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } + @MainActor @available(iOS 13.0, *) - internal func testPreviewForHighlightingContextMenuWithConfiguration() throws { + func testPreviewForHighlightingContextMenuWithConfiguration() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -1283,8 +1331,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } + @MainActor @available(iOS 13.0, *) - internal func testPreviewForDismissingContextMenuWithConfiguration() throws { + func testPreviewForDismissingContextMenuWithConfiguration() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, @@ -1300,8 +1349,9 @@ internal class BaseCollectionViewAdapterUICollectionViewDelegateTests: XCTestCas ) } + @MainActor @available(iOS 13.0, *) - internal func testWillPerformPreviewActionForMenu() throws { + func testWillPerformPreviewActionForMenu() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/ListCollectionViewAdapterUICollectionViewDelegateTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/ListCollectionViewAdapterUICollectionViewDelegateTests.swift index 65df0d45..ce8d315c 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/ListCollectionViewAdapterUICollectionViewDelegateTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/ListCollectionViewAdapterUICollectionViewDelegateTests.swift @@ -2,8 +2,8 @@ import UIKit import XCTest -@MainActor -internal final class ListCollectionViewAdapterUICollectionViewDelegateTests: BaseCollectionViewAdapterUICollectionViewDelegateTests { +final class ListCollectionViewAdapterUICollectionViewDelegateTests: BaseCollectionViewAdapterUICollectionViewDelegateTests { + @MainActor override internal func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/SingleSectionCollectionViewAdapterUICollectionViewDelegateTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/SingleSectionCollectionViewAdapterUICollectionViewDelegateTests.swift index e81dd5f6..b02f27af 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/SingleSectionCollectionViewAdapterUICollectionViewDelegateTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegate/SingleSectionCollectionViewAdapterUICollectionViewDelegateTests.swift @@ -2,8 +2,8 @@ import UIKit import XCTest -@MainActor -internal final class SingleSectionCollectionViewAdapterUICollectionViewDelegateTests: BaseCollectionViewAdapterUICollectionViewDelegateTests { +final class SingleSectionCollectionViewAdapterUICollectionViewDelegateTests: BaseCollectionViewAdapterUICollectionViewDelegateTests { + @MainActor override internal func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegateFlowLayout/SingleSectionCollectionViewAdapterUICollectionViewDelegateFlowLayoutTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegateFlowLayout/SingleSectionCollectionViewAdapterUICollectionViewDelegateFlowLayoutTests.swift index c8049f1d..9f742de6 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegateFlowLayout/SingleSectionCollectionViewAdapterUICollectionViewDelegateFlowLayoutTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDelegateFlowLayout/SingleSectionCollectionViewAdapterUICollectionViewDelegateFlowLayoutTests.swift @@ -2,9 +2,9 @@ import UIKit import XCTest -@MainActor -internal final class SingleSectionCollectionViewAdapterUICollectionViewDelegateFlowLayoutTests: BaseCollectionViewAdapterUICollectionViewDelegateFlowLayoutTests { - override internal func createCollectionViewAdapter( +final class SingleSectionCollectionViewAdapterUICollectionViewDelegateFlowLayoutTests: BaseCollectionViewAdapterUICollectionViewDelegateFlowLayoutTests { + @MainActor + override func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDragDelegate/BaseCollectionViewAdapterUICollectionViewDragDelegateTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDragDelegate/BaseCollectionViewAdapterUICollectionViewDragDelegateTests.swift index 5206be14..884141c1 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDragDelegate/BaseCollectionViewAdapterUICollectionViewDragDelegateTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDragDelegate/BaseCollectionViewAdapterUICollectionViewDragDelegateTests.swift @@ -2,28 +2,28 @@ import UIKit import XCTest -@MainActor @available(iOS 11.0, *) -internal class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTestCase { +class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseCollectionViewAdapterUICollectionViewDragDelegateTests.self else { return } throw XCTSkip("Tests from base class are skipped") } - internal func createCollectionView( + func createCollectionView( frame: CGRect = .zero, collectionViewLayout layout: UICollectionViewLayout? = nil ) -> UICollectionView { UICollectionView(frame: frame, collectionViewLayout: layout ?? UICollectionViewFlowLayout()) } - internal func createCollectionViewAdapter( + @MainActor + func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, @@ -35,7 +35,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTes // MARK: - itemsForBeginning - internal func testItemsForBeginningWithDelegate() throws { + @MainActor + func testItemsForBeginningWithDelegate() throws { let testExpectation = expectation(description: "Should invoke drag delegate") let collectionView = createCollectionView() let mockSession = MockDragSession() @@ -70,7 +71,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testItemsForBeginningWithoutDelegate() throws { + @MainActor + func testItemsForBeginningWithoutDelegate() throws { let collectionView = createCollectionView() let mockSession = MockDragSession() let itemIndexPath = IndexPath(item: 0, section: 0) @@ -93,7 +95,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTes // MARK: - itemsForAdding - internal func testItemsForAddingWithDelegate() throws { + @MainActor + func testItemsForAddingWithDelegate() throws { let testExpectation = expectation(description: "Should invoke drag delegate") let collectionView = createCollectionView() let mockSession = MockDragSession() @@ -131,7 +134,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testItemsForAddingWithoutDelegate() throws { + @MainActor + func testItemsForAddingWithoutDelegate() throws { let collectionView = createCollectionView() let mockSession = MockDragSession() let itemIndexPath = IndexPath(item: 0, section: 0) @@ -159,7 +163,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTes // MARK: - dragPreviewParametersForItem - internal func testDragPreviewParametersForItemWithDelegate() throws { + @MainActor + func testDragPreviewParametersForItemWithDelegate() throws { let testExpectation = expectation(description: "Should invoke drag delegate") let collectionView = createCollectionView() let itemIndexPath = IndexPath(item: 0, section: 0) @@ -191,7 +196,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testDragPreviewParametersForItemWithoutDelegate() throws { + @MainActor + func testDragPreviewParametersForItemWithoutDelegate() throws { let collectionView = createCollectionView() let itemIndexPath = IndexPath(item: 0, section: 0) let adapter = try createCollectionViewAdapter( @@ -214,7 +220,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTes // MARK: - dragSessionWillBegin - internal func testDragSessionWillBegin() throws { + @MainActor + func testDragSessionWillBegin() throws { let testExpectation = expectation(description: "Should invoke drag delegate") let collectionView = createCollectionView() let mockSession = MockDragSession() @@ -244,7 +251,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTes // MARK: - dragSessionDidEnd - internal func testDragSessionDidEnd() throws { + @MainActor + func testDragSessionDidEnd() throws { let testExpectation = expectation(description: "Should invoke drag delegate") let collectionView = createCollectionView() let mockSession = MockDragSession() @@ -274,7 +282,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTes // MARK: - dragSessionAllowsMoveOperation - internal func testDragSessionAllowsMoveOperation() throws { + @MainActor + func testDragSessionAllowsMoveOperation() throws { let collectionView = createCollectionView() let mockSession = MockDragSession() let adapter = try createCollectionViewAdapter( @@ -291,7 +300,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDragDelegateTests: XCTes // MARK: - dragSessionIsRestrictedToDraggingApplication - internal func testDragSessionIsRestrictedToDraggingApplication() throws { + @MainActor + func testDragSessionIsRestrictedToDraggingApplication() throws { let collectionView = createCollectionView() let mockSession = MockDragSession() let adapter = try createCollectionViewAdapter( diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDragDelegate/SingleSectionCollectionViewAdapterUICollectionViewDragDelegateTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDragDelegate/SingleSectionCollectionViewAdapterUICollectionViewDragDelegateTests.swift index c8c152b2..d78751cc 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDragDelegate/SingleSectionCollectionViewAdapterUICollectionViewDragDelegateTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDragDelegate/SingleSectionCollectionViewAdapterUICollectionViewDragDelegateTests.swift @@ -2,10 +2,10 @@ import UIKit import XCTest -@MainActor @available(iOS 11.0, *) -internal final class SingleSectionCollectionViewAdapterUICollectionViewDragDelegateTests: BaseCollectionViewAdapterUICollectionViewDragDelegateTests { - override internal func createCollectionViewAdapter( +final class SingleSectionCollectionViewAdapterUICollectionViewDragDelegateTests: BaseCollectionViewAdapterUICollectionViewDragDelegateTests { + @MainActor + override func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/BaseCollectionViewAdapterUICollectionViewDropDelegateTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/BaseCollectionViewAdapterUICollectionViewDropDelegateTests.swift index 43524efe..1050d07a 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/BaseCollectionViewAdapterUICollectionViewDropDelegateTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/BaseCollectionViewAdapterUICollectionViewDropDelegateTests.swift @@ -2,28 +2,28 @@ import UIKit import XCTest -@MainActor @available(iOS 11.0, *) -internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTestCase { +class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseCollectionViewAdapterUICollectionViewDropDelegateTests.self else { return } throw XCTSkip("Tests from base class are skipped") } - internal func createCollectionView( + func createCollectionView( frame: CGRect = .zero, collectionViewLayout layout: UICollectionViewLayout? = nil ) -> UICollectionView { UICollectionView(frame: frame, collectionViewLayout: layout ?? UICollectionViewFlowLayout()) } - internal func createCollectionViewAdapter( + @MainActor + func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, @@ -35,7 +35,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes // MARK: - canHandle - internal func testCanHandleWithDelegate() throws { + @MainActor + func testCanHandleWithDelegate() throws { let testExpectation = expectation(description: "Should invoke drop delegate") let collectionView = createCollectionView() let mockSession = MockDropSession() @@ -64,7 +65,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testCanHandleWithoutDelegate() throws { + @MainActor + func testCanHandleWithoutDelegate() throws { let collectionView = createCollectionView() let mockSession = MockDropSession() let adapter = try createCollectionViewAdapter( @@ -85,7 +87,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes // MARK: - dropSessionDidUpdate - internal func testDropSessionDidUpdateWithDestinationIndexPathAndWithInvalidIndex() throws { + @MainActor + func testDropSessionDidUpdateWithDestinationIndexPathAndWithInvalidIndex() throws { let testExpectation = expectation(description: "Should not invoke drop delegate") testExpectation.fulfill() let collectionView = createCollectionView() @@ -119,7 +122,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testDropSessionDidUpdateWithDestinationIndexPathAndWithDelegate() throws { + @MainActor + func testDropSessionDidUpdateWithDestinationIndexPathAndWithDelegate() throws { let testExpectation = expectation(description: "Should invoke drop delegate") let collectionView = createCollectionView() let mockSession = MockDropSession() @@ -154,7 +158,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testDropSessionDidUpdateWithDestinationIndexPathAndWithoutDelegate() throws { + @MainActor + func testDropSessionDidUpdateWithDestinationIndexPathAndWithoutDelegate() throws { let collectionView = createCollectionView() let mockSession = MockDropSession() let indexPath = IndexPath(item: 0, section: 0) @@ -178,7 +183,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes ) } - internal func testDropSessionDidUpdateWithoutDestinationIndexPathAndWithDelegate() throws { + @MainActor + func testDropSessionDidUpdateWithoutDestinationIndexPathAndWithDelegate() throws { let testExpectation = expectation(description: "Should invoke drop delegate") let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) collectionView._indexPathForItem = { _ in IndexPath(item: 0, section: 0) } @@ -213,7 +219,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testDropSessionDidUpdateWithoutDestinationIndexPathButInvalidLocation() throws { + @MainActor + func testDropSessionDidUpdateWithoutDestinationIndexPathButInvalidLocation() throws { let testExpectation = expectation(description: "Should invoke indexPathForItem") let mockPoint = CGPoint(x: 1, y: 2) let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) @@ -241,7 +248,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testDropSessionDidUpdateWithoutDestinationIndexPathButLocationOfInvalidIndexPath() throws { + @MainActor + func testDropSessionDidUpdateWithoutDestinationIndexPathButLocationOfInvalidIndexPath() throws { let testExpectation = expectation(description: "Should invoke indexPathForItem") let mockPoint = CGPoint(x: 1, y: 2) let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) @@ -269,7 +277,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testDropSessionDidUpdateWithoutDestinationIndexPathAndWithoutDelegate() throws { + @MainActor + func testDropSessionDidUpdateWithoutDestinationIndexPathAndWithoutDelegate() throws { let testExpectation = expectation(description: "Should invoke indexPathForItem") let mockPoint = CGPoint(x: 1, y: 2) let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) @@ -303,7 +312,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes // MARK: - performDrop - internal func testPerformDropWithoutDestinationIndexPath() throws { + @MainActor + func testPerformDropWithoutDestinationIndexPath() throws { let testExpectation = expectation(description: "Should not invoke drop delegate") testExpectation.fulfill() let coordinator = MockCollectionViewDropCoordinator() @@ -329,7 +339,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testPerformDropWithInvalidDestinationIndexPath() throws { + @MainActor + func testPerformDropWithInvalidDestinationIndexPath() throws { let testExpectation = expectation(description: "Should not invoke drop delegate") testExpectation.fulfill() let coordinator = MockCollectionViewDropCoordinator() @@ -355,7 +366,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testPerformDropWithUnknownDestinationIndexPath() throws { + @MainActor + func testPerformDropWithUnknownDestinationIndexPath() throws { let testExpectation = expectation(description: "Should not invoke drop delegate") testExpectation.fulfill() let coordinator = MockCollectionViewDropCoordinator() @@ -381,7 +393,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testPerformDropFromDifferentLocalSection() throws { + @MainActor + func testPerformDropFromDifferentLocalSection() throws { let testExpectation = expectation(description: "Should not invoke drop delegate") testExpectation.fulfill() let coordinator = MockCollectionViewDropCoordinator() @@ -414,7 +427,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testPerformDropFromSameLocalSection() throws { + @MainActor + func testPerformDropFromSameLocalSection() throws { let testExpectation = expectation(description: "Should invoke drop delegate") let coordinator = MockCollectionViewDropCoordinator() coordinator.destinationIndexPath = IndexPath(item: 0, section: 0) @@ -446,7 +460,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testPerformDropFromRemote() throws { + @MainActor + func testPerformDropFromRemote() throws { let testExpectation = expectation(description: "Should invoke drop delegate") let coordinator = MockCollectionViewDropCoordinator() coordinator.destinationIndexPath = IndexPath(item: 0, section: 0) @@ -474,7 +489,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testPerformDropWithoutDelegate() throws { + @MainActor + func testPerformDropWithoutDelegate() throws { let coordinator = MockCollectionViewDropCoordinator() coordinator.destinationIndexPath = IndexPath(item: 0, section: 0) let collectionView = createCollectionView() @@ -493,7 +509,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes // MARK: - dropSessionDidEnter - internal func testDropSessionDidEnter() throws { + @MainActor + func testDropSessionDidEnter() throws { let testExpectation = expectation(description: "Should invoke drop delegate") let mockSession = MockDropSession() let collectionView = createCollectionView() @@ -520,7 +537,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes // MARK: - dropSessionDidExit - internal func testDropSessionDidExit() throws { + @MainActor + func testDropSessionDidExit() throws { let testExpectation = expectation(description: "Should invoke drop delegate") let mockSession = MockDropSession() let collectionView = createCollectionView() @@ -547,7 +565,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes // MARK: - dropSessionDidEnd - internal func testDropSessionDidEnd() throws { + @MainActor + func testDropSessionDidEnd() throws { let testExpectation = expectation(description: "Should invoke drop delegate") let mockSession = MockDropSession() let collectionView = createCollectionView() @@ -574,7 +593,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes // MARK: - dropPreviewParametersForItem - internal func testDropPreviewParametersForItemWithDelegate() throws { + @MainActor + func testDropPreviewParametersForItemWithDelegate() throws { let testExpectation = expectation(description: "Should invoke drop delegate") let itemIndexPath = IndexPath(item: 0, section: 0) let mockPreviewParameters = UIDragPreviewParameters() @@ -606,7 +626,8 @@ internal class BaseCollectionViewAdapterUICollectionViewDropDelegateTests: XCTes waitForExpectations(timeout: 1) } - internal func testDropPreviewParametersForItemWithoutDelegate() throws { + @MainActor + func testDropPreviewParametersForItemWithoutDelegate() throws { let collectionView = createCollectionView() let adapter = try createCollectionViewAdapter( collectionView: collectionView, diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/ListCollectionViewAdapterUICollectionViewDropDelegateTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/ListCollectionViewAdapterUICollectionViewDropDelegateTests.swift index 10875847..d7b9a531 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/ListCollectionViewAdapterUICollectionViewDropDelegateTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/ListCollectionViewAdapterUICollectionViewDropDelegateTests.swift @@ -2,9 +2,9 @@ import UIKit import XCTest -@MainActor @available(iOS 11.0, *) -internal final class ListCollectionViewAdapterUICollectionViewDropDelegateTests: BaseCollectionViewAdapterUICollectionViewDropDelegateTests { +final class ListCollectionViewAdapterUICollectionViewDropDelegateTests: BaseCollectionViewAdapterUICollectionViewDropDelegateTests { + @MainActor override internal func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], diff --git a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/SingleSectionCollectionViewAdapterUICollectionViewDropDelegateTests.swift b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/SingleSectionCollectionViewAdapterUICollectionViewDropDelegateTests.swift index 7b6bf72f..3ec3590e 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/SingleSectionCollectionViewAdapterUICollectionViewDropDelegateTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UICollectionViewDropDelegate/SingleSectionCollectionViewAdapterUICollectionViewDropDelegateTests.swift @@ -2,10 +2,10 @@ import UIKit import XCTest -@MainActor @available(iOS 11.0, *) -internal final class SingleSectionCollectionViewAdapterUICollectionViewDropDelegateTests: BaseCollectionViewAdapterUICollectionViewDropDelegateTests { - override internal func createCollectionViewAdapter( +final class SingleSectionCollectionViewAdapterUICollectionViewDropDelegateTests: BaseCollectionViewAdapterUICollectionViewDropDelegateTests { + @MainActor + override func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, diff --git a/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/BaseCollectionViewAdapterUIScrollViewDelegateTests.swift b/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/BaseCollectionViewAdapterUIScrollViewDelegateTests.swift index 203e881a..96eff4d0 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/BaseCollectionViewAdapterUIScrollViewDelegateTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/BaseCollectionViewAdapterUIScrollViewDelegateTests.swift @@ -2,27 +2,27 @@ import UIKit import XCTest -@MainActor -internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { +class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseCollectionViewAdapterUIScrollViewDelegateTests.self else { return } throw XCTSkip("Tests from base class are skipped") } - internal func createCollectionView( + func createCollectionView( frame: CGRect = .zero, collectionViewLayout layout: UICollectionViewLayout? = nil ) -> UICollectionView { UICollectionView(frame: frame, collectionViewLayout: layout ?? UICollectionViewFlowLayout()) } - internal func createCollectionViewAdapter( + @MainActor + func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, @@ -32,7 +32,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { throw XCTSkip("Tests from base class are skipped") } - internal func testScrollViewDidScroll() throws { + @MainActor + func testScrollViewDidScroll() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -48,7 +49,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testScrollViewDidZoom() throws { + @MainActor + func testScrollViewDidZoom() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -64,7 +66,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testScrollViewWillBeginDragging() throws { + @MainActor + func testScrollViewWillBeginDragging() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -80,7 +83,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testScrollViewWillEndDragging() throws { + @MainActor + func testScrollViewWillEndDragging() throws { let velocity = CGPoint(x: 1, y: 2) let targetContentOffset = CGPoint(x: 4, y: 8) let testExpectation = expectation(description: "Should invoke scroll delegate") @@ -105,7 +109,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testScrollViewDidEndDragging() throws { + @MainActor + func testScrollViewDidEndDragging() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -122,7 +127,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testScrollViewWillBeginDecelerating() throws { + @MainActor + func testScrollViewWillBeginDecelerating() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -138,7 +144,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testScrollViewDidEndDecelerating() throws { + @MainActor + func testScrollViewDidEndDecelerating() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -154,7 +161,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testScrollViewDidEndScrollingAnimation() throws { + @MainActor + func testScrollViewDidEndScrollingAnimation() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -170,7 +178,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testViewForZooming() throws { + @MainActor + func testViewForZooming() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -188,7 +197,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testScrollViewWillBeginZooming() throws { + @MainActor + func testScrollViewWillBeginZooming() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -206,7 +216,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testScrollViewDidEndZooming() throws { + @MainActor + func testScrollViewDidEndZooming() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -225,7 +236,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testScrollViewShouldScrollToTop() throws { + @MainActor + func testScrollViewShouldScrollToTop() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -242,7 +254,8 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testScrollViewDidScrollToTop() throws { + @MainActor + func testScrollViewDidScrollToTop() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() @@ -258,8 +271,9 @@ internal class BaseCollectionViewAdapterUIScrollViewDelegateTests: XCTestCase { waitForExpectations(timeout: 1) } + @MainActor @available(iOS 11.0, *) - internal func testScrollViewDidChangeAdjustedContentInset() throws { + func testScrollViewDidChangeAdjustedContentInset() throws { let testExpectation = expectation(description: "Should invoke scroll delegate") let collectionView = createCollectionView() let scrollViewDelegate = MockScrollViewDelegate() diff --git a/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/ListCollectionViewAdapterUIScrollViewDelegateTests.swift b/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/ListCollectionViewAdapterUIScrollViewDelegateTests.swift index 6fce48ab..3ea28e10 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/ListCollectionViewAdapterUIScrollViewDelegateTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/ListCollectionViewAdapterUIScrollViewDelegateTests.swift @@ -2,9 +2,9 @@ import UIKit import XCTest -@MainActor -internal final class ListCollectionViewAdapterUIScrollViewDelegateTests: BaseCollectionViewAdapterUIScrollViewDelegateTests { - override internal func createCollectionViewAdapter( +final class ListCollectionViewAdapterUIScrollViewDelegateTests: BaseCollectionViewAdapterUIScrollViewDelegateTests { + @MainActor + override func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, diff --git a/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/SingleSectionCollectionViewAdapterUIScrollViewDelegateTests.swift b/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/SingleSectionCollectionViewAdapterUIScrollViewDelegateTests.swift index eb321b1f..3790036d 100644 --- a/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/SingleSectionCollectionViewAdapterUIScrollViewDelegateTests.swift +++ b/SectionKit/Tests/CollectionViewAdapter/UIScrollViewDelegate/SingleSectionCollectionViewAdapterUIScrollViewDelegateTests.swift @@ -2,9 +2,9 @@ import UIKit import XCTest -@MainActor -internal final class SingleSectionCollectionViewAdapterUIScrollViewDelegateTests: BaseCollectionViewAdapterUIScrollViewDelegateTests { - override internal func createCollectionViewAdapter( +final class SingleSectionCollectionViewAdapterUIScrollViewDelegateTests: BaseCollectionViewAdapterUIScrollViewDelegateTests { + @MainActor + override func createCollectionViewAdapter( collectionView: UICollectionView, sections: [Section] = [], viewController: UIViewController? = nil, diff --git a/SectionKit/Tests/SectionController/BaseSectionControllerTests.swift b/SectionKit/Tests/SectionController/BaseSectionControllerTests.swift index 26a3edb7..0ee6ddd5 100644 --- a/SectionKit/Tests/SectionController/BaseSectionControllerTests.swift +++ b/SectionKit/Tests/SectionController/BaseSectionControllerTests.swift @@ -1,47 +1,54 @@ import SectionKit import XCTest -@MainActor -internal final class BaseSectionControllerTests: XCTestCase { - internal func testContextIsNil() { +final class BaseSectionControllerTests: XCTestCase { + @MainActor + func testContextIsNil() { let sectionController = BaseSectionController() XCTAssertNil(sectionController.context) } - internal func testDataSourceIsSelf() { + @MainActor + func testDataSourceIsSelf() { let sectionController = BaseSectionController() XCTAssert(sectionController.dataSource === sectionController) } + @MainActor @available(iOS 10.0, *) - internal func testDataSourcePrefetchingDelegateIsSelf() { + func testDataSourcePrefetchingDelegateIsSelf() { let sectionController = BaseSectionController() XCTAssert(sectionController.dataSourcePrefetchingDelegate === sectionController) } - internal func testDelegateIsSelf() { + @MainActor + func testDelegateIsSelf() { let sectionController = BaseSectionController() XCTAssert(sectionController.delegate === sectionController) } + @MainActor internal func testFlowDelegateIsSelf() { let sectionController = BaseSectionController() XCTAssert(sectionController.flowDelegate === sectionController) } @available(iOS 11.0, *) - internal func testDragDelegateIsSelf() { + @MainActor + func testDragDelegateIsSelf() { let sectionController = BaseSectionController() XCTAssert(sectionController.dragDelegate === sectionController) } + @MainActor @available(iOS 11.0, *) - internal func testDropDelegateIsSelf() { + func testDropDelegateIsSelf() { let sectionController = BaseSectionController() XCTAssert(sectionController.dropDelegate === sectionController) } - internal func testDidUpdateModelDoesNothing() { + @MainActor + func testDidUpdateModelDoesNothing() { let sectionController = BaseSectionController() sectionController.didUpdate(model: "") } diff --git a/SectionKit/Tests/SectionController/ListSectionControllerTests.swift b/SectionKit/Tests/SectionController/ListSectionControllerTests.swift index 4aa22352..be716a84 100644 --- a/SectionKit/Tests/SectionController/ListSectionControllerTests.swift +++ b/SectionKit/Tests/SectionController/ListSectionControllerTests.swift @@ -1,15 +1,16 @@ @testable import SectionKit import XCTest -@MainActor -internal final class ListSectionControllerTests: XCTestCase { - internal func testDidUpdateModelWithValidTypeSetsModel() { +final class ListSectionControllerTests: XCTestCase { + @MainActor + func testDidUpdateModelWithValidTypeSetsModel() { let sectionController = ListSectionController(model: "1") sectionController.didUpdate(model: "2") XCTAssertEqual(sectionController.model, "2") } - internal func testDidUpdateModelWithInvalidType() { + @MainActor + func testDidUpdateModelWithInvalidType() { let errorExpectation = expectation(description: "The errorHandler should be called") let sectionController = ListSectionController(model: "1") let context = MainCollectionViewContext( @@ -32,7 +33,8 @@ internal final class ListSectionControllerTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testInitDoesNotUpdateItemsIfShouldNotUpdateItems() { + @MainActor + func testInitDoesNotUpdateItemsIfShouldNotUpdateItems() { class TestSectionController: ListSectionController { var itemsForModelExpectation: XCTestExpectation? @@ -56,7 +58,8 @@ internal final class ListSectionControllerTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testSettingModelDoesNotUpdateItemsIfShouldNotUpdateItems() { + @MainActor + func testSettingModelDoesNotUpdateItemsIfShouldNotUpdateItems() { class TestSectionController: ListSectionController { var itemsForModelExpectation: XCTestExpectation? @@ -83,12 +86,14 @@ internal final class ListSectionControllerTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testShouldUpdateItemsDefaultsToTrue() { + @MainActor + func testShouldUpdateItemsDefaultsToTrue() { let sectionController = ListSectionController(model: "1") XCTAssert(sectionController.shouldUpdateItems(afterModelChangedTo: "2")) } - internal func testItemsForModelInvokesNotImplementedError() { + @MainActor + func testItemsForModelInvokesNotImplementedError() { let errorExpectation = expectation(description: "The errorHandler should be called") let sectionController = ListSectionController(model: "1") let context = MainCollectionViewContext( @@ -108,7 +113,8 @@ internal final class ListSectionControllerTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testNumberOfItems() { + @MainActor + func testNumberOfItems() { let sectionController = ListSectionController(model: "1") sectionController.items = ["1", "2"] let context = MainCollectionViewContext( diff --git a/SectionKit/Tests/SectionController/SectionDataSource/BaseSectionControllerSectionDataSourceTests.swift b/SectionKit/Tests/SectionController/SectionDataSource/BaseSectionControllerSectionDataSourceTests.swift index ec0b8ca3..39630800 100644 --- a/SectionKit/Tests/SectionController/SectionDataSource/BaseSectionControllerSectionDataSourceTests.swift +++ b/SectionKit/Tests/SectionController/SectionDataSource/BaseSectionControllerSectionDataSourceTests.swift @@ -1,8 +1,8 @@ import SectionKit import XCTest -@MainActor -internal final class BaseSectionControllerSectionDataSourceTests: BaseSectionDataSourceTests { +final class BaseSectionControllerSectionDataSourceTests: BaseSectionDataSourceTests { + @MainActor override func createSectionDataSource() throws -> SectionDataSource { BaseSectionController() } diff --git a/SectionKit/Tests/SectionController/SectionDataSource/BaseSectionDataSourceTests.swift b/SectionKit/Tests/SectionController/SectionDataSource/BaseSectionDataSourceTests.swift index a27e3c49..721334c8 100644 --- a/SectionKit/Tests/SectionController/SectionDataSource/BaseSectionDataSourceTests.swift +++ b/SectionKit/Tests/SectionController/SectionDataSource/BaseSectionDataSourceTests.swift @@ -1,24 +1,25 @@ import SectionKit import XCTest -@MainActor -internal class BaseSectionDataSourceTests: XCTestCase { +class BaseSectionDataSourceTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseSectionDataSourceTests.self else { return } throw XCTSkip("Tests from base class are skipped") } - internal func createSectionDataSource() throws -> SectionDataSource { + @MainActor + func createSectionDataSource() throws -> SectionDataSource { throw XCTSkip("Tests from base class are skipped") } - internal func testNumberOfItems() throws { + @MainActor + func testNumberOfItems() throws { let sectionDataSource = try createSectionDataSource() let context = MainCollectionViewContext( viewController: nil, @@ -28,7 +29,8 @@ internal class BaseSectionDataSourceTests: XCTestCase { XCTAssertEqual(sectionDataSource.numberOfItems(in: context), 0) } - internal func testCellForItem() throws { + @MainActor + func testCellForItem() throws { let errorExpectation = expectation(description: "The errorHandler should be called") let sectionDataSource = try createSectionDataSource() let context = MainCollectionViewContext( @@ -54,7 +56,8 @@ internal class BaseSectionDataSourceTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testHeaderView() throws { + @MainActor + func testHeaderView() throws { let errorExpectation = expectation(description: "The errorHandler should be called") let sectionDataSource = try createSectionDataSource() let context = MainCollectionViewContext( @@ -80,7 +83,8 @@ internal class BaseSectionDataSourceTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testFooterView() throws { + @MainActor + func testFooterView() throws { let errorExpectation = expectation(description: "The errorHandler should be called") let sectionDataSource = try createSectionDataSource() let context = MainCollectionViewContext( @@ -106,7 +110,8 @@ internal class BaseSectionDataSourceTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testCanMoveItem() throws { + @MainActor + func testCanMoveItem() throws { let sectionDataSource = try createSectionDataSource() let context = MainCollectionViewContext( viewController: nil, @@ -117,7 +122,8 @@ internal class BaseSectionDataSourceTests: XCTestCase { XCTAssertFalse(sectionDataSource.canMoveItem(at: indexPath, in: context)) } - internal func testMoveItem() throws { + @MainActor + func testMoveItem() throws { let sectionDataSource = try createSectionDataSource() let context = MainCollectionViewContext( viewController: nil, diff --git a/SectionKit/Tests/SectionController/SectionDataSource/ProtocolDefaultValuesSectionDataSourceTests.swift b/SectionKit/Tests/SectionController/SectionDataSource/ProtocolDefaultValuesSectionDataSourceTests.swift index 26439d23..ea2450b3 100644 --- a/SectionKit/Tests/SectionController/SectionDataSource/ProtocolDefaultValuesSectionDataSourceTests.swift +++ b/SectionKit/Tests/SectionController/SectionDataSource/ProtocolDefaultValuesSectionDataSourceTests.swift @@ -1,8 +1,8 @@ import SectionKit import XCTest -@MainActor -internal final class ProtocolDefaultValuesSectionDataSourceTests: BaseSectionDataSourceTests { +final class ProtocolDefaultValuesSectionDataSourceTests: BaseSectionDataSourceTests { + @MainActor override func createSectionDataSource() throws -> SectionDataSource { class DefaultSectionDataSource: SectionDataSource { func numberOfItems(in context: CollectionViewContext) -> Int { diff --git a/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/BaseSectionControllerSectionDataSourcePrefetchingDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/BaseSectionControllerSectionDataSourcePrefetchingDelegateTests.swift index 84096c71..f7ca5f05 100644 --- a/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/BaseSectionControllerSectionDataSourcePrefetchingDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/BaseSectionControllerSectionDataSourcePrefetchingDelegateTests.swift @@ -1,9 +1,9 @@ import SectionKit import XCTest -@MainActor @available(iOS 10.0, *) -internal final class BaseSectionControllerSectionDataSourcePrefetchingDelegateTests: BaseSectionDataSourcePrefetchingDelegateTests { +final class BaseSectionControllerSectionDataSourcePrefetchingDelegateTests: BaseSectionDataSourcePrefetchingDelegateTests { + @MainActor override func createSectionDataSourcePrefetchingDelegate() throws -> SectionDataSourcePrefetchingDelegate { BaseSectionController() } diff --git a/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/BaseSectionDataSourcePrefetchingDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/BaseSectionDataSourcePrefetchingDelegateTests.swift index 52db69de..d33993e1 100644 --- a/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/BaseSectionDataSourcePrefetchingDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/BaseSectionDataSourcePrefetchingDelegateTests.swift @@ -1,25 +1,26 @@ import SectionKit import XCTest -@MainActor @available(iOS 10.0, *) -internal class BaseSectionDataSourcePrefetchingDelegateTests: XCTestCase { +class BaseSectionDataSourcePrefetchingDelegateTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseSectionDataSourcePrefetchingDelegateTests.self else { return } throw XCTSkip("Tests from base class are skipped") } - internal func createSectionDataSourcePrefetchingDelegate() throws -> SectionDataSourcePrefetchingDelegate { + @MainActor + func createSectionDataSourcePrefetchingDelegate() throws -> SectionDataSourcePrefetchingDelegate { throw XCTSkip("Tests from base class are skipped") } - internal func testPrefetchItems() throws { + @MainActor + func testPrefetchItems() throws { let sectionDataSourcePrefetchingDelegate = try createSectionDataSourcePrefetchingDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -29,7 +30,8 @@ internal class BaseSectionDataSourcePrefetchingDelegateTests: XCTestCase { sectionDataSourcePrefetchingDelegate.prefetchItems(at: [], in: context) } - internal func testCancelPrefetchingForItems() throws { + @MainActor + func testCancelPrefetchingForItems() throws { let sectionDataSourcePrefetchingDelegate = try createSectionDataSourcePrefetchingDelegate() let context = MainCollectionViewContext( viewController: nil, diff --git a/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/ProtocolDefaultValuesSectionDataSourcePrefetchingDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/ProtocolDefaultValuesSectionDataSourcePrefetchingDelegateTests.swift index 2a7e2c49..25d2d4fc 100644 --- a/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/ProtocolDefaultValuesSectionDataSourcePrefetchingDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDataSourcePrefetchingDelegate/ProtocolDefaultValuesSectionDataSourcePrefetchingDelegateTests.swift @@ -1,9 +1,9 @@ import SectionKit import XCTest -@MainActor @available(iOS 10.0, *) -internal final class ProtocolDefaultValuesSectionDataSourcePrefetchingDelegateTests: BaseSectionDataSourcePrefetchingDelegateTests { +final class ProtocolDefaultValuesSectionDataSourcePrefetchingDelegateTests: BaseSectionDataSourcePrefetchingDelegateTests { + @MainActor override func createSectionDataSourcePrefetchingDelegate() throws -> SectionDataSourcePrefetchingDelegate { class DefaultSectionDataSourcePrefetchingDelegate: SectionDataSourcePrefetchingDelegate { func prefetchItems(at indexPaths: [SectionIndexPath], in context: CollectionViewContext) { } diff --git a/SectionKit/Tests/SectionController/SectionDelegate/BaseSectionControllerSectionDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDelegate/BaseSectionControllerSectionDelegateTests.swift index fa3e5011..4a865224 100644 --- a/SectionKit/Tests/SectionController/SectionDelegate/BaseSectionControllerSectionDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDelegate/BaseSectionControllerSectionDelegateTests.swift @@ -1,8 +1,8 @@ import SectionKit import XCTest -@MainActor -internal final class BaseSectionControllerSectionDelegateTests: BaseSectionDelegateTests { +final class BaseSectionControllerSectionDelegateTests: BaseSectionDelegateTests { + @MainActor override func createSectionDelegate() throws -> SectionDelegate { BaseSectionController() } diff --git a/SectionKit/Tests/SectionController/SectionDelegate/BaseSectionDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDelegate/BaseSectionDelegateTests.swift index db4a12c6..8a8f06e8 100644 --- a/SectionKit/Tests/SectionController/SectionDelegate/BaseSectionDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDelegate/BaseSectionDelegateTests.swift @@ -1,24 +1,25 @@ import SectionKit import XCTest -@MainActor -internal class BaseSectionDelegateTests: XCTestCase { +class BaseSectionDelegateTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseSectionDelegateTests.self else { return } throw XCTSkip("Tests from base class are skipped") } - internal func createSectionDelegate() throws -> SectionDelegate { + @MainActor + func createSectionDelegate() throws -> SectionDelegate { throw XCTSkip("Tests from base class are skipped") } - internal func testShouldHighlightItem() throws { + @MainActor + func testShouldHighlightItem() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -29,7 +30,8 @@ internal class BaseSectionDelegateTests: XCTestCase { XCTAssert(sectionDelegate.shouldHighlightItem(at: indexPath, in: context)) } - internal func testDidHighlightItem() throws { + @MainActor + func testDidHighlightItem() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -40,7 +42,8 @@ internal class BaseSectionDelegateTests: XCTestCase { sectionDelegate.didHighlightItem(at: indexPath, in: context) } - internal func testDidUnhighlightItem() throws { + @MainActor + func testDidUnhighlightItem() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -51,7 +54,8 @@ internal class BaseSectionDelegateTests: XCTestCase { sectionDelegate.didUnhighlightItem(at: indexPath, in: context) } - internal func testShouldSelectItem() throws { + @MainActor + func testShouldSelectItem() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -62,7 +66,8 @@ internal class BaseSectionDelegateTests: XCTestCase { XCTAssert(sectionDelegate.shouldSelectItem(at: indexPath, in: context)) } - internal func testShouldDeselectItem() throws { + @MainActor + func testShouldDeselectItem() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -73,7 +78,8 @@ internal class BaseSectionDelegateTests: XCTestCase { XCTAssert(sectionDelegate.shouldDeselectItem(at: indexPath, in: context)) } - internal func testDidSelectItem() throws { + @MainActor + func testDidSelectItem() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -84,7 +90,8 @@ internal class BaseSectionDelegateTests: XCTestCase { sectionDelegate.didSelectItem(at: indexPath, in: context) } - internal func testDidDeselectItem() throws { + @MainActor + func testDidDeselectItem() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -95,7 +102,8 @@ internal class BaseSectionDelegateTests: XCTestCase { sectionDelegate.didDeselectItem(at: indexPath, in: context) } - internal func testWillDisplayCell() throws { + @MainActor + func testWillDisplayCell() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -110,7 +118,8 @@ internal class BaseSectionDelegateTests: XCTestCase { ) } - internal func testWillDisplayHeaderView() throws { + @MainActor + func testWillDisplayHeaderView() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -125,7 +134,8 @@ internal class BaseSectionDelegateTests: XCTestCase { ) } - internal func testWillDisplayFooterView() throws { + @MainActor + func testWillDisplayFooterView() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -140,7 +150,8 @@ internal class BaseSectionDelegateTests: XCTestCase { ) } - internal func testDidEndDisplayingCell() throws { + @MainActor + func testDidEndDisplayingCell() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -155,7 +166,8 @@ internal class BaseSectionDelegateTests: XCTestCase { ) } - internal func testDidEndDisplayingHeaderView() throws { + @MainActor + func testDidEndDisplayingHeaderView() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -170,7 +182,8 @@ internal class BaseSectionDelegateTests: XCTestCase { ) } - internal func testDidEndDisplayingFooterView() throws { + @MainActor + func testDidEndDisplayingFooterView() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -186,8 +199,9 @@ internal class BaseSectionDelegateTests: XCTestCase { } // availability attribute is needed because of deprecation warning + @MainActor @available(iOS, introduced: 6.0, deprecated: 13.0) - internal func testShouldShowMenuForItem() throws { + func testShouldShowMenuForItem() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -202,8 +216,9 @@ internal class BaseSectionDelegateTests: XCTestCase { } // availability attribute is needed because of deprecation warning + @MainActor @available(iOS, introduced: 6.0, deprecated: 13.0) - internal func testCanPerform() throws { + func testCanPerform() throws { class Mock { @objc func perform() { } @@ -225,8 +240,9 @@ internal class BaseSectionDelegateTests: XCTestCase { } // availability attribute is needed because of deprecation warning + @MainActor @available(iOS, introduced: 6.0, deprecated: 13.0) - internal func testPerform() throws { + func testPerform() throws { class Mock { @objc func perform() { } @@ -247,7 +263,8 @@ internal class BaseSectionDelegateTests: XCTestCase { ) } - internal func testCanFocusItem() throws { + @MainActor + func testCanFocusItem() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -267,8 +284,9 @@ internal class BaseSectionDelegateTests: XCTestCase { ) } + @MainActor @available(iOS 11.0, *) - internal func testShouldSpringLoadItem() throws { + func testShouldSpringLoadItem() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -284,8 +302,9 @@ internal class BaseSectionDelegateTests: XCTestCase { )) } + @MainActor @available(iOS 13.0, *) - internal func testShouldBeginMultipleSelectionInteraction() throws { + func testShouldBeginMultipleSelectionInteraction() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -299,8 +318,9 @@ internal class BaseSectionDelegateTests: XCTestCase { )) } + @MainActor @available(iOS 13.0, *) - internal func testDidBeginMultipleSelectionInteraction() throws { + func testDidBeginMultipleSelectionInteraction() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -314,8 +334,9 @@ internal class BaseSectionDelegateTests: XCTestCase { ) } + @MainActor @available(iOS 13.0, *) - internal func testContextMenuConfigurationForItem() throws { + func testContextMenuConfigurationForItem() throws { let sectionDelegate = try createSectionDelegate() let context = MainCollectionViewContext( viewController: nil, diff --git a/SectionKit/Tests/SectionController/SectionDelegate/ProtocolDefaultValuesSectionDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDelegate/ProtocolDefaultValuesSectionDelegateTests.swift index cc57ad87..b908b3b1 100644 --- a/SectionKit/Tests/SectionController/SectionDelegate/ProtocolDefaultValuesSectionDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDelegate/ProtocolDefaultValuesSectionDelegateTests.swift @@ -1,8 +1,8 @@ import SectionKit import XCTest -@MainActor -internal final class ProtocolDefaultValuesSectionDelegateTests: BaseSectionDelegateTests { +final class ProtocolDefaultValuesSectionDelegateTests: BaseSectionDelegateTests { + @MainActor override func createSectionDelegate() throws -> SectionDelegate { class DefaultSectionDelegate: SectionDelegate { } return DefaultSectionDelegate() diff --git a/SectionKit/Tests/SectionController/SectionDragDelegate/BaseSectionControllerSectionDragDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDragDelegate/BaseSectionControllerSectionDragDelegateTests.swift index 05b44795..6d8cb1dc 100644 --- a/SectionKit/Tests/SectionController/SectionDragDelegate/BaseSectionControllerSectionDragDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDragDelegate/BaseSectionControllerSectionDragDelegateTests.swift @@ -1,9 +1,9 @@ import SectionKit import XCTest -@MainActor @available(iOS 11.0, *) -internal final class BaseSectionControllerSectionDragDelegateTests: BaseSectionDragDelegateTests { +final class BaseSectionControllerSectionDragDelegateTests: BaseSectionDragDelegateTests { + @MainActor override func createSectionDragDelegate() throws -> SectionDragDelegate { BaseSectionController() } diff --git a/SectionKit/Tests/SectionController/SectionDragDelegate/BaseSectionDragDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDragDelegate/BaseSectionDragDelegateTests.swift index 0ca1b261..e0b7d7ab 100644 --- a/SectionKit/Tests/SectionController/SectionDragDelegate/BaseSectionDragDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDragDelegate/BaseSectionDragDelegateTests.swift @@ -1,25 +1,26 @@ import SectionKit import XCTest -@MainActor @available(iOS 11.0, *) -internal class BaseSectionDragDelegateTests: XCTestCase { +class BaseSectionDragDelegateTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseSectionDragDelegateTests.self else { return } throw XCTSkip("Tests from base class are skipped") } - internal func createSectionDragDelegate() throws -> SectionDragDelegate { + @MainActor + func createSectionDragDelegate() throws -> SectionDragDelegate { throw XCTSkip("Tests from base class are skipped") } - internal func testDragItemsForBeginning() throws { + @MainActor + func testDragItemsForBeginning() throws { let sectionDragDelegate = try createSectionDragDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -35,7 +36,8 @@ internal class BaseSectionDragDelegateTests: XCTestCase { ).isEmpty) } - internal func testDragItemsForAdding() throws { + @MainActor + func testDragItemsForAdding() throws { let sectionDragDelegate = try createSectionDragDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -52,7 +54,8 @@ internal class BaseSectionDragDelegateTests: XCTestCase { ).isEmpty) } - internal func testDragSessionWillBegin() throws { + @MainActor + func testDragSessionWillBegin() throws { let sectionDragDelegate = try createSectionDragDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -66,7 +69,8 @@ internal class BaseSectionDragDelegateTests: XCTestCase { ) } - internal func testDragSessionDidEnd() throws { + @MainActor + func testDragSessionDidEnd() throws { let sectionDragDelegate = try createSectionDragDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -80,7 +84,8 @@ internal class BaseSectionDragDelegateTests: XCTestCase { ) } - internal func testDragPreviewParametersForItem() throws { + @MainActor + func testDragPreviewParametersForItem() throws { let sectionDragDelegate = try createSectionDragDelegate() let context = MainCollectionViewContext( viewController: nil, diff --git a/SectionKit/Tests/SectionController/SectionDragDelegate/ProtocolDefaultValuesSectionDragDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDragDelegate/ProtocolDefaultValuesSectionDragDelegateTests.swift index c5b2a12e..8125a215 100644 --- a/SectionKit/Tests/SectionController/SectionDragDelegate/ProtocolDefaultValuesSectionDragDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDragDelegate/ProtocolDefaultValuesSectionDragDelegateTests.swift @@ -3,6 +3,7 @@ import XCTest @available(iOS 11.0, *) internal final class ProtocolDefaultValuesSectionDragDelegateTests: BaseSectionDragDelegateTests { + @MainActor override func createSectionDragDelegate() throws -> SectionDragDelegate { class DefaultSectionDragDelegate: SectionDragDelegate { func dragItems( diff --git a/SectionKit/Tests/SectionController/SectionDropDelegate/BaseSectionControllerSectionDropDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDropDelegate/BaseSectionControllerSectionDropDelegateTests.swift index 7ca0e2a3..aebb9d34 100644 --- a/SectionKit/Tests/SectionController/SectionDropDelegate/BaseSectionControllerSectionDropDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDropDelegate/BaseSectionControllerSectionDropDelegateTests.swift @@ -1,9 +1,9 @@ import SectionKit import XCTest -@MainActor @available(iOS 11.0, *) -internal final class BaseSectionControllerSectionDropDelegateTests: BaseSectionDropDelegateTests { +final class BaseSectionControllerSectionDropDelegateTests: BaseSectionDropDelegateTests { + @MainActor override func createSectionDropDelegate() throws -> SectionDropDelegate { BaseSectionController() } diff --git a/SectionKit/Tests/SectionController/SectionDropDelegate/BaseSectionDropDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDropDelegate/BaseSectionDropDelegateTests.swift index c9977495..fe3b26d4 100644 --- a/SectionKit/Tests/SectionController/SectionDropDelegate/BaseSectionDropDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDropDelegate/BaseSectionDropDelegateTests.swift @@ -1,25 +1,26 @@ import SectionKit import XCTest -@MainActor @available(iOS 11.0, *) -internal class BaseSectionDropDelegateTests: XCTestCase { +class BaseSectionDropDelegateTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseSectionDropDelegateTests.self else { return } throw XCTSkip("Tests from base class are skipped") } - internal func createSectionDropDelegate() throws -> SectionDropDelegate { + @MainActor + func createSectionDropDelegate() throws -> SectionDropDelegate { throw XCTSkip("Tests from base class are skipped") } - internal func testCanHandle() throws { + @MainActor + func testCanHandle() throws { let sectionDropDelegate = try createSectionDropDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -33,7 +34,8 @@ internal class BaseSectionDropDelegateTests: XCTestCase { )) } - internal func testDropSessionDidUpdate() throws { + @MainActor + func testDropSessionDidUpdate() throws { let sectionDropDelegate = try createSectionDropDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -52,7 +54,8 @@ internal class BaseSectionDropDelegateTests: XCTestCase { ) } - internal func testPerformDrop() throws { + @MainActor + func testPerformDrop() throws { let sectionDropDelegate = try createSectionDropDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -68,7 +71,8 @@ internal class BaseSectionDropDelegateTests: XCTestCase { ) } - internal func testDropSessionDidEnter() throws { + @MainActor + func testDropSessionDidEnter() throws { let sectionDropDelegate = try createSectionDropDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -82,7 +86,8 @@ internal class BaseSectionDropDelegateTests: XCTestCase { ) } - internal func testDropSessionDidExit() throws { + @MainActor + func testDropSessionDidExit() throws { let sectionDropDelegate = try createSectionDropDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -96,7 +101,8 @@ internal class BaseSectionDropDelegateTests: XCTestCase { ) } - internal func testDropSessionDidEnd() throws { + @MainActor + func testDropSessionDidEnd() throws { let sectionDropDelegate = try createSectionDropDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -110,7 +116,8 @@ internal class BaseSectionDropDelegateTests: XCTestCase { ) } - internal func testDropPreviewParametersForItem() throws { + @MainActor + func testDropPreviewParametersForItem() throws { let sectionDropDelegate = try createSectionDropDelegate() let context = MainCollectionViewContext( viewController: nil, diff --git a/SectionKit/Tests/SectionController/SectionDropDelegate/ProtocolDefaultValuesSectionDropDelegateTests.swift b/SectionKit/Tests/SectionController/SectionDropDelegate/ProtocolDefaultValuesSectionDropDelegateTests.swift index 838d6eca..1d063d82 100644 --- a/SectionKit/Tests/SectionController/SectionDropDelegate/ProtocolDefaultValuesSectionDropDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionDropDelegate/ProtocolDefaultValuesSectionDropDelegateTests.swift @@ -1,9 +1,9 @@ import SectionKit import XCTest -@MainActor @available(iOS 11.0, *) internal final class ProtocolDefaultValuesSectionDropDelegateTests: BaseSectionDropDelegateTests { + @MainActor override func createSectionDropDelegate() throws -> SectionDropDelegate { class DefaultSectionDropDelegate: SectionDropDelegate { func performDrop( diff --git a/SectionKit/Tests/SectionController/SectionFlowDelegate/BaseFlowLayoutSectionControllerSectionFlowDelegateTests.swift b/SectionKit/Tests/SectionController/SectionFlowDelegate/BaseFlowLayoutSectionControllerSectionFlowDelegateTests.swift index aab5c664..33ad1775 100644 --- a/SectionKit/Tests/SectionController/SectionFlowDelegate/BaseFlowLayoutSectionControllerSectionFlowDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionFlowDelegate/BaseFlowLayoutSectionControllerSectionFlowDelegateTests.swift @@ -1,7 +1,7 @@ import SectionKit import XCTest -internal final class BaseSectionControllerSectionFlowDelegateTests: BaseSectionFlowDelegateTests { +final class BaseSectionControllerSectionFlowDelegateTests: BaseSectionFlowDelegateTests { @MainActor override func createSectionFlowDelegate() throws -> SectionFlowDelegate { BaseSectionController() diff --git a/SectionKit/Tests/SectionController/SectionFlowDelegate/BaseFlowLayoutSectionFlowDelegateTests.swift b/SectionKit/Tests/SectionController/SectionFlowDelegate/BaseFlowLayoutSectionFlowDelegateTests.swift index 33c25f83..ba809351 100644 --- a/SectionKit/Tests/SectionController/SectionFlowDelegate/BaseFlowLayoutSectionFlowDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionFlowDelegate/BaseFlowLayoutSectionFlowDelegateTests.swift @@ -1,25 +1,25 @@ import SectionKit import XCTest -internal class BaseSectionFlowDelegateTests: XCTestCase { +class BaseSectionFlowDelegateTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() continueAfterFailure = false try skipIfNeeded() } - internal func skipIfNeeded() throws { + func skipIfNeeded() throws { guard Self.self === BaseSectionFlowDelegateTests.self else { return } throw XCTSkip("Tests from base class are skipped") } @MainActor - internal func createSectionFlowDelegate() throws -> SectionFlowDelegate { + func createSectionFlowDelegate() throws -> SectionFlowDelegate { throw XCTSkip("Tests from base class are skipped") } @MainActor - internal func testSizeForItemWithFlowLayout() throws { + func testSizeForItemWithFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -41,7 +41,7 @@ internal class BaseSectionFlowDelegateTests: XCTestCase { } @MainActor - internal func testSizeForItemWithoutFlowLayout() throws { + func testSizeForItemWithoutFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -61,7 +61,7 @@ internal class BaseSectionFlowDelegateTests: XCTestCase { } @MainActor - internal func testInsetWithFlowLayout() throws { + func testInsetWithFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -81,7 +81,7 @@ internal class BaseSectionFlowDelegateTests: XCTestCase { } @MainActor - internal func testInsetWithoutFlowLayout() throws { + func testInsetWithoutFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -99,7 +99,7 @@ internal class BaseSectionFlowDelegateTests: XCTestCase { } @MainActor - internal func testMinimumLineSpacingWithFlowLayout() throws { + func testMinimumLineSpacingWithFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -118,7 +118,7 @@ internal class BaseSectionFlowDelegateTests: XCTestCase { } @MainActor - internal func testMinimumLineSpacingWithoutFlowLayout() throws { + func testMinimumLineSpacingWithoutFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -136,7 +136,7 @@ internal class BaseSectionFlowDelegateTests: XCTestCase { } @MainActor - internal func testMinimumInteritemSpacingWithFlowLayout() throws { + func testMinimumInteritemSpacingWithFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -155,7 +155,7 @@ internal class BaseSectionFlowDelegateTests: XCTestCase { } @MainActor - internal func testMinimumInteritemSpacingWithoutFlowLayout() throws { + func testMinimumInteritemSpacingWithoutFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -173,7 +173,7 @@ internal class BaseSectionFlowDelegateTests: XCTestCase { } @MainActor - internal func testReferenceSizeForHeaderWithFlowLayout() throws { + func testReferenceSizeForHeaderWithFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -193,7 +193,7 @@ internal class BaseSectionFlowDelegateTests: XCTestCase { } @MainActor - internal func testReferenceSizeForHeaderWithoutFlowLayout() throws { + func testReferenceSizeForHeaderWithoutFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -211,7 +211,7 @@ internal class BaseSectionFlowDelegateTests: XCTestCase { } @MainActor - internal func testReferenceSizeForFooterWithFlowLayout() throws { + func testReferenceSizeForFooterWithFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, @@ -231,7 +231,7 @@ internal class BaseSectionFlowDelegateTests: XCTestCase { } @MainActor - internal func testReferenceSizeForFooterWithoutFlowLayout() throws { + func testReferenceSizeForFooterWithoutFlowLayout() throws { let sectionFlowDelegate = try createSectionFlowDelegate() let context = MainCollectionViewContext( viewController: nil, diff --git a/SectionKit/Tests/SectionController/SectionFlowDelegate/ProtocolDefaultValuesSectionFlowDelegateTests.swift b/SectionKit/Tests/SectionController/SectionFlowDelegate/ProtocolDefaultValuesSectionFlowDelegateTests.swift index 11d7246e..b1009abe 100644 --- a/SectionKit/Tests/SectionController/SectionFlowDelegate/ProtocolDefaultValuesSectionFlowDelegateTests.swift +++ b/SectionKit/Tests/SectionController/SectionFlowDelegate/ProtocolDefaultValuesSectionFlowDelegateTests.swift @@ -1,8 +1,8 @@ import SectionKit import XCTest -@MainActor -internal final class ProtocolDefaultValuesSectionFlowDelegateTests: BaseSectionFlowDelegateTests { +final class ProtocolDefaultValuesSectionFlowDelegateTests: BaseSectionFlowDelegateTests { + @MainActor override func createSectionFlowDelegate() throws -> SectionFlowDelegate { class DefaultSectionFlowDelegate: SectionFlowDelegate { } return DefaultSectionFlowDelegate() diff --git a/SectionKit/Tests/SectionController/SingleItemSectionControllerTests.swift b/SectionKit/Tests/SectionController/SingleItemSectionControllerTests.swift index 4077f3ee..fced1a85 100644 --- a/SectionKit/Tests/SectionController/SingleItemSectionControllerTests.swift +++ b/SectionKit/Tests/SectionController/SingleItemSectionControllerTests.swift @@ -1,15 +1,16 @@ @testable import SectionKit import XCTest -@MainActor -internal final class SingleItemSectionControllerTests: XCTestCase { - internal func testDidUpdateModelWithValidTypeSetsModel() { +final class SingleItemSectionControllerTests: XCTestCase { + @MainActor + func testDidUpdateModelWithValidTypeSetsModel() { let sectionController = SingleItemSectionController(model: "1") sectionController.didUpdate(model: "2") XCTAssertEqual(sectionController.model, "2") } - internal func testDidUpdateModelWithInvalidType() { + @MainActor + func testDidUpdateModelWithInvalidType() { let errorExpectation = expectation(description: "The errorHandler should be called") let sectionController = SingleItemSectionController(model: "1") let context = MainCollectionViewContext( @@ -32,7 +33,8 @@ internal final class SingleItemSectionControllerTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testInitDoesNotUpdateItemIfShouldNotUpdateItem() { + @MainActor + func testInitDoesNotUpdateItemIfShouldNotUpdateItem() { class TestSectionController: SingleItemSectionController { var itemsForModelExpectation: XCTestExpectation? @@ -56,7 +58,8 @@ internal final class SingleItemSectionControllerTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testSettingModelDoesNotUpdateItemIfShouldNotUpdateItem() { + @MainActor + func testSettingModelDoesNotUpdateItemIfShouldNotUpdateItem() { class TestSectionController: SingleItemSectionController { var itemsForModelExpectation: XCTestExpectation? @@ -83,12 +86,14 @@ internal final class SingleItemSectionControllerTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testShouldUpdateItemDefaultsToTrue() { + @MainActor + func testShouldUpdateItemDefaultsToTrue() { let sectionController = SingleItemSectionController(model: "1") XCTAssert(sectionController.shouldUpdateItem(afterModelChangedTo: "2")) } - internal func testItemForModelInvokesNotImplementedError() { + @MainActor + func testItemForModelInvokesNotImplementedError() { let errorExpectation = expectation(description: "The errorHandler should be called") let sectionController = SingleItemSectionController(model: "1") let context = MainCollectionViewContext( @@ -108,7 +113,8 @@ internal final class SingleItemSectionControllerTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testCalculateUpdateFromSomeToSomeWithEqualItems() throws { + @MainActor + func testCalculateUpdateFromSomeToSomeWithEqualItems() throws { let sectionController = SingleItemSectionController(model: "") let update = try XCTUnwrap( sectionController.calculateUpdate( @@ -125,7 +131,8 @@ internal final class SingleItemSectionControllerTests: XCTestCase { XCTAssertFalse(update.shouldReload(batchOperation)) } - internal func testCalculateUpdateFromSomeToSomeWithDifferentItems() throws { + @MainActor + func testCalculateUpdateFromSomeToSomeWithDifferentItems() throws { let sectionController = SingleItemSectionController(model: "") let update = try XCTUnwrap( sectionController.calculateUpdate( @@ -142,7 +149,8 @@ internal final class SingleItemSectionControllerTests: XCTestCase { XCTAssertFalse(update.shouldReload(batchOperation)) } - internal func testCalculateUpdateFromNoneToSome() throws { + @MainActor + func testCalculateUpdateFromNoneToSome() throws { let sectionController = SingleItemSectionController(model: "") let update = try XCTUnwrap( sectionController.calculateUpdate( @@ -159,7 +167,8 @@ internal final class SingleItemSectionControllerTests: XCTestCase { XCTAssertFalse(update.shouldReload(batchOperation)) } - internal func testCalculateUpdateFromSomeToNone() throws { + @MainActor + func testCalculateUpdateFromSomeToNone() throws { let sectionController = SingleItemSectionController(model: "") let update = try XCTUnwrap( sectionController.calculateUpdate( @@ -176,7 +185,8 @@ internal final class SingleItemSectionControllerTests: XCTestCase { XCTAssertFalse(update.shouldReload(batchOperation)) } - internal func testCalculateUpdateFromNoneToNone() throws { + @MainActor + func testCalculateUpdateFromNoneToNone() throws { let sectionController = SingleItemSectionController(model: "") let update = try XCTUnwrap( sectionController.calculateUpdate( @@ -193,7 +203,8 @@ internal final class SingleItemSectionControllerTests: XCTestCase { XCTAssertFalse(update.shouldReload(batchOperation)) } - internal func testNumberOfItemsWithItem() { + @MainActor + func testNumberOfItemsWithItem() { let sectionController = SingleItemSectionController(model: "1") sectionController.item = "1" let context = MainCollectionViewContext( @@ -204,7 +215,8 @@ internal final class SingleItemSectionControllerTests: XCTestCase { XCTAssertEqual(sectionController.numberOfItems(in: context), 1) } - internal func testNumberOfItemsWithoutItem() { + @MainActor + func testNumberOfItemsWithoutItem() { let sectionController = SingleItemSectionController(model: "1") sectionController.item = nil let context = MainCollectionViewContext( diff --git a/SectionKit/Tests/SectionController/SingleModelSectionControllerTests.swift b/SectionKit/Tests/SectionController/SingleModelSectionControllerTests.swift index 15c142e9..88b29c62 100644 --- a/SectionKit/Tests/SectionController/SingleModelSectionControllerTests.swift +++ b/SectionKit/Tests/SectionController/SingleModelSectionControllerTests.swift @@ -1,15 +1,16 @@ @testable import SectionKit import XCTest -@MainActor -internal final class SingleModelSectionControllerTests: XCTestCase { - internal func testDidUpdateModelWithValidTypeSetsModel() { +final class SingleModelSectionControllerTests: XCTestCase { + @MainActor + func testDidUpdateModelWithValidTypeSetsModel() { let sectionController = SingleModelSectionController(model: "1") sectionController.didUpdate(model: "2") XCTAssertEqual(sectionController.model, "2") } - internal func testDidUpdateModelWithInvalidType() { + @MainActor + func testDidUpdateModelWithInvalidType() { let errorExpectation = expectation(description: "The errorHandler should be called") let sectionController = SingleModelSectionController(model: "1") let context = MainCollectionViewContext( @@ -32,7 +33,8 @@ internal final class SingleModelSectionControllerTests: XCTestCase { waitForExpectations(timeout: 1) } - internal func testCalculateUpdateFromSomeToSomeWithDifferentItems() throws { + @MainActor + func testCalculateUpdateFromSomeToSomeWithDifferentItems() throws { let sectionController = SingleModelSectionController(model: 1) let update = try XCTUnwrap( sectionController.calculateUpdate( @@ -49,7 +51,8 @@ internal final class SingleModelSectionControllerTests: XCTestCase { XCTAssert(update.shouldReload(batchOperation)) } - internal func testNumberOfItems() { + @MainActor + func testNumberOfItems() { let sectionController = SingleModelSectionController(model: "1") let context = MainCollectionViewContext( viewController: nil, diff --git a/SectionKit/Tests/Utility/UICollectionViewApplyTests.swift b/SectionKit/Tests/Utility/UICollectionViewApplyTests.swift index e65b61dd..1e75842b 100644 --- a/SectionKit/Tests/Utility/UICollectionViewApplyTests.swift +++ b/SectionKit/Tests/Utility/UICollectionViewApplyTests.swift @@ -1,11 +1,11 @@ @testable import SectionKit import XCTest -@MainActor -internal final class UICollectionViewApplyTests: XCTestCase { +final class UICollectionViewApplyTests: XCTestCase { // MARK: - CollectionViewSectionUpdate - internal func testSectionUpdateEmptyBatchOperations() { + @MainActor + func testSectionUpdateEmptyBatchOperations() { let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let update = CollectionViewSectionUpdate( controller: BaseSectionController(), @@ -15,7 +15,8 @@ internal final class UICollectionViewApplyTests: XCTestCase { collectionView.apply(update: update, at: 0) } - internal func testSectionUpdateWithoutWindowWithSingleBatchOperation() { + @MainActor + func testSectionUpdateWithoutWindowWithSingleBatchOperation() { let setDataExpectation = expectation(description: "Should invoke setData") let reloadDataExpectation = expectation(description: "Should invoke reloadData") let completionExpectation = expectation(description: "Should invoke completion of batch operation") @@ -51,7 +52,8 @@ internal final class UICollectionViewApplyTests: XCTestCase { ) } - internal func testSectionUpdateWithoutWindowWithMultipleBatchOperations() { + @MainActor + func testSectionUpdateWithoutWindowWithMultipleBatchOperations() { let firstSetDataExpectation = expectation(description: "Should invoke setData for first data") let secondSetDataExpectation = expectation(description: "Should invoke setData for second data") let reloadDataExpectation = expectation(description: "Should invoke reloadData") @@ -106,7 +108,8 @@ internal final class UICollectionViewApplyTests: XCTestCase { ) } - internal func testSectionUpdateWithWindowWithSingleBatchOperationWithAlwaysReload() { + @MainActor + func testSectionUpdateWithWindowWithSingleBatchOperationWithAlwaysReload() { let performBatchUpdatesExpectation = expectation(description: "Should invoke performBatchUpdates") let setDataExpectation = expectation(description: "Should invoke setData") let reloadSectionsExpectation = expectation(description: "Should invoke reloadSections") @@ -163,7 +166,8 @@ internal final class UICollectionViewApplyTests: XCTestCase { ) } - internal func testSectionUpdateWithWindowWithSingleBatchOperationWithSeparateUpdates() { + @MainActor + func testSectionUpdateWithWindowWithSingleBatchOperationWithSeparateUpdates() { let performBatchUpdatesExpectation = expectation(description: "Should invoke performBatchUpdates") let setDataExpectation = expectation(description: "Should invoke setData") let deleteItemsExpectation = expectation(description: "Should invoke deleteItems") @@ -264,7 +268,8 @@ internal final class UICollectionViewApplyTests: XCTestCase { // MARK: - CollectionViewUpdate - internal func testUpdateEmptyBatchOperations() { + @MainActor + func testUpdateEmptyBatchOperations() { let collectionView = MockCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let update = CollectionViewUpdate( batchOperations: [], @@ -308,7 +313,8 @@ internal final class UICollectionViewApplyTests: XCTestCase { ) } - internal func testUpdateWithoutWindowWithMultipleBatchOperations() { + @MainActor + func testUpdateWithoutWindowWithMultipleBatchOperations() { let firstSetDataExpectation = expectation(description: "Should invoke setData for first data") let secondSetDataExpectation = expectation(description: "Should invoke setData for second data") let reloadDataExpectation = expectation(description: "Should invoke reloadData") @@ -361,7 +367,8 @@ internal final class UICollectionViewApplyTests: XCTestCase { ) } - internal func testUpdateWithWindowWithSingleBatchOperationWithAlwaysReload() { + @MainActor + func testUpdateWithWindowWithSingleBatchOperationWithAlwaysReload() { let setDataExpectation = expectation(description: "Should invoke setData") let reloadDataExpectation = expectation(description: "Should invoke reloadData") let completionExpectation = expectation(description: "Should invoke completion of batch operation") @@ -408,7 +415,8 @@ internal final class UICollectionViewApplyTests: XCTestCase { ) } - internal func testUpdateWithWindowWithSingleBatchOperationWithSeparateUpdates() { + @MainActor + func testUpdateWithWindowWithSingleBatchOperationWithSeparateUpdates() { let performBatchUpdatesExpectation = expectation(description: "Should invoke performBatchUpdates") let setDataExpectation = expectation(description: "Should invoke setData") let deleteSectionsExpectation = expectation(description: "Should invoke deleteSections")