-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to Xcode 16 + address Swift concurrency issues #116
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jessesquires
changed the title
[Fixes and updates for Xcode 16
Fixes and updates for Xcode 16 + Swift 6.0
Jul 2, 2024
jessesquires
force-pushed
the
xcode-16-main
branch
4 times, most recently
from
July 13, 2024 21:31
9ca7f41
to
1e5c224
Compare
jessesquires
force-pushed
the
xcode-16-main
branch
2 times, most recently
from
July 26, 2024 21:14
7fd1638
to
1cdcb56
Compare
jessesquires
force-pushed
the
xcode-16-main
branch
from
August 13, 2024 18:06
1cdcb56
to
c5dff4f
Compare
jessesquires
force-pushed
the
xcode-16-main
branch
from
October 2, 2024 18:52
c5dff4f
to
0717a84
Compare
jessesquires
changed the title
Fixes and updates for Xcode 16 + Swift 6.0
Update to Xcode 16 + address Swift concurrency issues
Oct 2, 2024
jessesquires
added a commit
that referenced
this pull request
Oct 14, 2024
This re-works `DiffableDataSource` to perform more operations on a background thread — namely building the initial snapshot and searching for items that need to be reconfigured. In extremely large collections, performing these operations on the main thread can produce noticeable lag. ### `Sendable` changes This also makes `DiffableViewModel` inherit from `Sendable`, which means this also applies to `CellViewModel`, `SupplementaryViewModel`, `SectionViewModel`, and `CollectionViewModel`. Early in development, I avoided doing this because I did not want to place the burden of `Sendable` on clients. Instead, I opted to make everything `@MainActor` (which is also a burden, in different ways). However, that was changed in #135. After the performance improvements in faabe72, making these types `Sendable` is more necessary. However, I think we can justify making all view models `Sendable` because all the view models _should_ be stateless / immutable. If you want to update the collection view, then you need to apply a new view model via `update(viewModel:)` — so it's not as if you could be mutating view model state outside of the `Driver` because those changes would not be reflected anyway. ### Swift 6 The only issue with adopting Swift 6 right now is that [`apply(_:animatingDifferences:completion:)`](https://developer.apple.com/documentation/uikit/uicollectionviewdiffabledatasource/3375795-apply) is incorrectly marked as `@MainActor`, which becomes an error in Swift 6. See #116. Otherwise, the library compiles successfully with Swift 6 and complete concurrency checking. 🎉
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The only issue with adopting Swift 6 right now is that
apply(_:animatingDifferences:completion:)
is incorrectly marked as@MainActor
, which becomes an error in Swift 6.