-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
New issue checklist
- I have reviewed the
READMEand documentation - I have searched existing issues and this is not a duplicate
- I have attempted to reproduce the issue and include an example project.
General information
IGListKitversion: 5.0.0- iOS version(s): All
- CocoaPods/Carthage version:
- Xcode version: 15.3
- Devices/Simulators affected: All
- Reproducible in the demo project? (Yes/No): Yes
- Related issues:
Debug information
IGListKit recently added NS_SWIFT_UI_ACTOR to IGListAdapterDataSource and IGListSingleSectionControllerDelegate in this commit which is great, and helps remove many Swift Concurrency warnings. There are a couple more classes / protocols that could benefit from the same treatment.
UICollectionViewCellis unable to conform toListBindabledue to "Main actor-isolated instance method 'bindViewModel' cannot be used to satisfy nonisolated protocol requirement". Doing anonisolatedimplementation is not a viable option, as this would require the cell to do something like this:
nonisolated func bindViewModel(_ viewModel: Any) {
Task { @MainActor in
/*
Cell will be populated asynchronously, which could cause a flicker,
or break unit tests that expect the cell to be populated immediately.
*/
titleLabel.text = viewModel.title
}
}
- Subclassing
ListSectionControlleris similarly problematic, as the functions it provides are currently non-isolated, but most of them will require calling UIKit, which is@MainActorisolated.
override func cellForItem(at index: Int) -> UICollectionViewCell {
let cell: MyCell = collectionContext!.dequeueFromNib(for: self, index: index)
/*
"Main actor-isolated property 'titleLabel' can not be referenced from a non-isolated context"
*/
cell.titleLabel.text = viewModel.title
return cell
}
These 2 instances are a couple examples that I spotted, but there could potentially exist more. I assume that IGListKit is underpinned by UICollectionViewDelegate/UICollectionViewDataSource which both are @MainActor/NS_SWIFT_UI_ACTOR, meaning that this addition could be quite straightforward.
pikxel, joeboyscout04, igorskeelo and richmondkofishbrainpikxel
Metadata
Metadata
Assignees
Labels
No labels