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
Reloading "state only values of specific items in horizontal section" is causing the section to scrollto first (it's reloading whole section)
///on cell did select
guard var currentSnapshot = dataSource?.snapshot() else { return }
var itemsToReload:[SomeClassTypeHashable] = []
//toggle state of current cell
let selectedItem = currentSnapshot.sectionIdentifiers[indexPath.section].items[indexPath.item]
if var item = selectedItem as? Playable{
item.isPlaying = !item.isPlaying
itemsToReload.append(selectedItem)
}
//reset state of all other cells as playing capabilities will only be available at one cell at a time.
currentSnapshot.sectionIdentifiers[indexPath.section].items.filter({(($0 as? Playable)?.isPlaying ?? false) == true && $0 != selectedItem}).forEach({
var prevItem = ($0 as! Playable)
prevItem.isPlaying = false
itemsToReload.append(castedPrevItem as! SomeClassTypeHashable)
})
currentSnapshot.reloadItems(itemsToReload)
dataSource?.apply(currentSnapshot)
Works perfectly in iOS 13 but scrolling issues are prominent in below versions of iOS 13.
The text was updated successfully, but these errors were encountered:
Reloading "state only values of specific items in horizontal section" is causing the section to scrollto first (it's reloading whole section)
Works perfectly in iOS 13 but scrolling issues are prominent in below versions of iOS 13.
The text was updated successfully, but these errors were encountered: