Skip to content

Entries with the uitableview tag

Pull request Potential fix for invalidation crashes on composed-swift/ComposedUI


As mentioned in https://github.com/composed-swift/ComposedUI/issues/13 and https://github.com/composed-swift/ComposedUI/issues/8 there are some scenarios where the collection view’s data is out-of-sync with the data in composed.

As mentioned in https://github.com/composed-swift/ComposedUI/issues/13 calling layoutIfNeeded can trigger the data to be in sync again. In this I have added it to mappingWillBeginUpdating(_:) which appears to solve the problem.

It might be needed in replace(sectionProvider:) (because reloadData is called) and/or mappingDidInvalidate(_:) (for the same reason) but I’m still investigating.

I have validated this fix against https://github.com/composed-swift/ComposedUI/issues/8 and it fixes the crash.

https://github.com/composed-swift/ComposedUI/issues/13 still needs to be investigated and may require layoutIfNeeded to be called in mappingDidInvalidate. Marking as a draft until this is checked.

Pull request Fix crash when performing update while animating on composed-swift/ComposedUI


The completion block is called when the animation has completed, but at the end of the updates block the data has already been updated (from the perspective of the UICollectionView).

Not calling reset() and setting defersUpdate = false could cause crashes e.g. due to changes being applied multiple times.

The best way to recreate this is to have a series of updates occur very close to each other but with the "Slow Animation" setting enabled in the simulator.

This change might also apply to table views, I have not checked.

The crash would often be along the lines of "Tried to delete section at index 11 but there were only 11 sections" or would occur in elementsProvider(for:) with the error "No UI configuration available for section 11" when performing a non-data change e.g. a reload of a section

Pull request Allow multiple cell types per section on composed-swift/ComposedUI


Sometimes it's useful to have multiple different cell types within a single section, for example to use sticky headers or to reduce to need for many layers of composition (which can be tricky to get animation right for).

This isn't a breaking change for consumers.

I think some of the naming should be improved if this were to be merged.

Draft because I want feedback on the impact of the feature itself rather than specifically the code.

Pull request Check for `CollectionCoordinator` rather than self on composed-swift/ComposedUI


Using embedded collection views with each one using a CollectionCoordinator would cause an infinite loop in responds(to:).

Maybe it's better to check in responds(to:)? I don't know if there are other scenarios this could happen in.