You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have attempted to reproduce the issue and include an example project.
General information
IGListKit version: 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.
UICollectionViewCell is unable to conform to ListBindable due to "Main actor-isolated instance method 'bindViewModel' cannot be used to satisfy nonisolated protocol requirement". Doing a nonisolated implementation 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 ListSectionController is similarly problematic, as the functions it provides are currently non-isolated, but most of them will require calling UIKit, which is @MainActor isolated.
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.
The text was updated successfully, but these errors were encountered:
New issue checklist
README
and documentationGeneral information
IGListKit
version: 5.0.0Debug information
IGListKit recently added
NS_SWIFT_UI_ACTOR
toIGListAdapterDataSource
andIGListSingleSectionControllerDelegate
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.UICollectionViewCell
is unable to conform toListBindable
due to "Main actor-isolated instance method 'bindViewModel' cannot be used to satisfy nonisolated protocol requirement". Doing anonisolated
implementation is not a viable option, as this would require the cell to do something like this:ListSectionController
is similarly problematic, as the functions it provides are currently non-isolated, but most of them will require calling UIKit, which is@MainActor
isolated.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.The text was updated successfully, but these errors were encountered: