diff --git a/CHANGELOG.md b/CHANGELOG.md index a4473fd..68ad96e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ NEXT - TBA +0.2.0 +----- + +This release closes the [0.2.0 milestone](https://github.com/jessesquires/ReactiveCollectionsKit/milestone/3?closed=1). + +**Breaking Changes:** +- Adopt Swift 6 and Swift Concurrency, remove `CollectionViewDriverOptions.diffOnBackgroundQueue`. ([@jessesquires](https://github.com/jessesquires), [#157](https://github.com/jessesquires/ReactiveCollectionsKit/issues/157), [#158](https://github.com/jessesquires/ReactiveCollectionsKit/pull/158)) **See linked issue and pull request for decision to remove `diffOnBackgroundQueue`.** + 0.1.9 ----- diff --git a/Example/Sources/List/ListViewController.swift b/Example/Sources/List/ListViewController.swift index c198ef3..b275eef 100644 --- a/Example/Sources/List/ListViewController.swift +++ b/Example/Sources/List/ListViewController.swift @@ -20,7 +20,6 @@ final class ListViewController: ExampleViewController, CellEventCoordinator { lazy var driver: CollectionViewDriver = { let driver = CollectionViewDriver( view: self.collectionView, - options: .init(diffOnBackgroundQueue: true), emptyViewProvider: sharedEmptyViewProvider, cellEventCoordinator: self ) diff --git a/Package.swift b/Package.swift index be02109..ea43a34 100644 --- a/Package.swift +++ b/Package.swift @@ -41,16 +41,5 @@ let package = Package( ] ) ], - swiftLanguageModes: [.v5] + swiftLanguageModes: [.v6] ) - -#warning("Remove after Swift 6 language mode") -let swiftSettings = [ - SwiftSetting.enableExperimentalFeature("StrictConcurrency") -] - -for target in package.targets { - var settings = target.swiftSettings ?? [] - settings.append(contentsOf: swiftSettings) - target.swiftSettings = settings -} diff --git a/README.md b/README.md index 252d6a4..1899c0c 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ driver.update(viewModel: updated) ## Requirements - iOS 16.0+ -- Swift 5.10+ +- Swift 6.0+ - Xcode 26.0+ - [SwiftLint](https://github.com/realm/SwiftLint) diff --git a/ReactiveCollectionsKit.xcodeproj/project.pbxproj b/ReactiveCollectionsKit.xcodeproj/project.pbxproj index a84eeb2..616392a 100644 --- a/ReactiveCollectionsKit.xcodeproj/project.pbxproj +++ b/ReactiveCollectionsKit.xcodeproj/project.pbxproj @@ -288,7 +288,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_STRICT_CONCURRENCY = complete; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; }; @@ -351,7 +351,7 @@ SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_STRICT_CONCURRENCY = complete; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; diff --git a/Sources/CollectionViewDriver.swift b/Sources/CollectionViewDriver.swift index 463b0e2..73ead96 100644 --- a/Sources/CollectionViewDriver.swift +++ b/Sources/CollectionViewDriver.swift @@ -92,7 +92,7 @@ public final class CollectionViewDriver: NSObject { // workaround for swift initialization rules. // the "real" init is below. - self._dataSource = DiffableDataSource(view: view, diffOnBackgroundQueue: false) + self._dataSource = DiffableDataSource(view: view) super.init() @@ -106,7 +106,6 @@ public final class CollectionViewDriver: NSObject { // `self` owns the `_dataSource`, so we know that `self` will always exist. self._dataSource = DiffableDataSource( view: view, - diffOnBackgroundQueue: options.diffOnBackgroundQueue, cellProvider: { [unowned self] view, indexPath, itemIdentifier in self._cellProvider( collectionView: view, diff --git a/Sources/CollectionViewDriverOptions.swift b/Sources/CollectionViewDriverOptions.swift index d8afbd9..f2b4aa2 100644 --- a/Sources/CollectionViewDriverOptions.swift +++ b/Sources/CollectionViewDriverOptions.swift @@ -15,11 +15,6 @@ import Foundation /// Defines various options to customize behavior of a ``CollectionViewDriver``. public struct CollectionViewDriverOptions: Hashable { - /// Specifies whether or not to perform diffing on a background queue. - /// Pass `true` to perform diffing in the background, - /// pass `false` to perform diffing on the main thread. - public let diffOnBackgroundQueue: Bool - /// Specifies whether or not the ``CollectionViewDriver`` should /// perform a hard `reloadData()` when replacing the ``CollectionViewModel`` with /// a new one, or if it should always perform a diff. @@ -31,13 +26,10 @@ public struct CollectionViewDriverOptions: Hashable { /// Initializes a `CollectionViewDriverOptions` object. /// /// - Parameters: - /// - diffOnBackgroundQueue: Whether or not to perform diffing on a background queue. Default is `false`. /// - reloadDataOnReplacingViewModel: Whether or not to reload or diff during replacement. Default is `false`. public init( - diffOnBackgroundQueue: Bool = false, reloadDataOnReplacingViewModel: Bool = false ) { - self.diffOnBackgroundQueue = diffOnBackgroundQueue self.reloadDataOnReplacingViewModel = reloadDataOnReplacingViewModel } } diff --git a/Sources/DebugDescriptions.swift b/Sources/DebugDescriptions.swift index bf912f6..30130d0 100644 --- a/Sources/DebugDescriptions.swift +++ b/Sources/DebugDescriptions.swift @@ -133,7 +133,6 @@ private func debugDescriptionBuilder( debugDescriptionBuilder( elements: [ (.type(CollectionViewDriverOptions.self), indent + 2), - (.field(label: "diffOnBackgroundQueue", value: options.diffOnBackgroundQueue), indent + 4), (.field(label: "reloadDataOnReplacingViewModel", value: options.reloadDataOnReplacingViewModel), indent + 4), (.end, indent + 2) ], @@ -203,7 +202,6 @@ func driverOptionsDebugDescription(_ options: CollectionViewDriverOptions) -> St debugDescriptionBuilder( elements: [ (.type(CollectionViewDriverOptions.self), 0), - (.field(label: "diffOnBackgroundQueue", value: options.diffOnBackgroundQueue), 2), (.field(label: "reloadDataOnReplacingViewModel", value: options.reloadDataOnReplacingViewModel), 2), (.end, 0) ], diff --git a/Sources/DiffableDataSource.swift b/Sources/DiffableDataSource.swift index 3828a53..7ec965d 100644 --- a/Sources/DiffableDataSource.swift +++ b/Sources/DiffableDataSource.swift @@ -26,34 +26,23 @@ final class DiffableDataSource: UICollectionViewDiffableDataSource, @@ -153,59 +123,49 @@ final class DiffableDataSource: UICollectionViewDiffableDataSource diff --git a/Tests/TestCollectionViewDriver.swift b/Tests/TestCollectionViewDriver.swift index 0bc9eb7..bbaddbc 100644 --- a/Tests/TestCollectionViewDriver.swift +++ b/Tests/TestCollectionViewDriver.swift @@ -430,23 +430,6 @@ final class TestCollectionViewDriver: UnitTestCase, @unchecked Sendable { self.waitForExpectations() } - @MainActor - func test_update_callsCompletion_withBackgroundDiffing() { - let driver = CollectionViewDriver( - view: self.collectionView, - options: .init(diffOnBackgroundQueue: true) - ) - - let expectation = self.expectation() - - let newModel = self.fakeCollectionViewModel() - driver.update(viewModel: newModel, animated: true) { _ in - expectation.fulfillAndLog() - } - - self.waitForExpectations() - } - @MainActor func test_update_callsCompletion_withReloadOnReplace() { let driver = CollectionViewDriver( diff --git a/Tests/TestCollectionViewDriverOptions.swift b/Tests/TestCollectionViewDriverOptions.swift index f505e7a..9f23c01 100644 --- a/Tests/TestCollectionViewDriverOptions.swift +++ b/Tests/TestCollectionViewDriverOptions.swift @@ -19,7 +19,6 @@ final class TestCollectionViewDriverOptions: XCTestCase { func test_defaultValues() { let options = CollectionViewDriverOptions() - XCTAssertFalse(options.diffOnBackgroundQueue) XCTAssertFalse(options.reloadDataOnReplacingViewModel) } @@ -29,21 +28,18 @@ final class TestCollectionViewDriverOptions: XCTestCase { options.debugDescription, """ CollectionViewDriverOptions { - diffOnBackgroundQueue: false reloadDataOnReplacingViewModel: false } """ ) let options2 = CollectionViewDriverOptions( - diffOnBackgroundQueue: true, reloadDataOnReplacingViewModel: true ) XCTAssertEqual( options2.debugDescription, """ CollectionViewDriverOptions { - diffOnBackgroundQueue: true reloadDataOnReplacingViewModel: true } """ diff --git a/Tests/TestDebugDescriptionDriver.swift b/Tests/TestDebugDescriptionDriver.swift index 3099dc7..003acd5 100644 --- a/Tests/TestDebugDescriptionDriver.swift +++ b/Tests/TestDebugDescriptionDriver.swift @@ -52,7 +52,6 @@ final class TestDebugDescriptionDriver: XCTestCase { CollectionViewDriver \\{ options: CollectionViewDriverOptions \\{ - diffOnBackgroundQueue: false reloadDataOnReplacingViewModel: false \\} viewModel: @@ -94,7 +93,6 @@ final class TestDebugDescriptionDriver: XCTestCase { CollectionViewDriver \\{ options: CollectionViewDriverOptions \\{ - diffOnBackgroundQueue: false reloadDataOnReplacingViewModel: false \\} viewModel: @@ -155,7 +153,6 @@ final class TestDebugDescriptionDriver: XCTestCase { CollectionViewDriver \\{ options: CollectionViewDriverOptions \\{ - diffOnBackgroundQueue: false reloadDataOnReplacingViewModel: false \\} viewModel: diff --git a/Tests/Utils/CollectionViewDriverOptions+Extensions.swift b/Tests/Utils/CollectionViewDriverOptions+Extensions.swift index e710e91..83d9c1a 100644 --- a/Tests/Utils/CollectionViewDriverOptions+Extensions.swift +++ b/Tests/Utils/CollectionViewDriverOptions+Extensions.swift @@ -16,6 +16,6 @@ import ReactiveCollectionsKit extension CollectionViewDriverOptions { static func test() -> Self { - .init(diffOnBackgroundQueue: false, reloadDataOnReplacingViewModel: true) + .init(reloadDataOnReplacingViewModel: true) } }