Add layout-aware drop targeting for custom layouts#605
Conversation
This change allows custom ListLayout implementations to override
drop target determination during interactive item reordering.
- Add targetIndexPath(forInteractivelyMovingItem:withPosition:) protocol
method to ListLayout with default nil implementation
- Add CollectionViewLayout override that delegates to custom layout
- Add isReorderable property on ListLayoutContent.ItemInfo to expose
whether an item has reordering enabled
| /// TODO: The default implementation provided by `UICollectionView` does not work correctly | ||
| /// when trying to move an item to the end of a section, or when trying to move an item into an | ||
| /// empty section. We should add casing that allows moving into the section in these cases. |
There was a problem hiding this comment.
do we need to keep this TODO?
There was a problem hiding this comment.
I think it's still true, it doesn't hurt to keep it, IMO (but then also, the TODO has been here forever, so I don't care either way)
There was a problem hiding this comment.
I'm okay either way. I lean towards removing since we don't have a good repro on file. I did some local testing and haven't run across these reordering issues on iOS 16 or iOS 26, so the issue may be fixed!
johnnewman-square
left a comment
There was a problem hiding this comment.
This looks great. It would be neat if we could spin up a demo controller for the sample app that showcases the new targetIndexPath(...) API.
| /// TODO: The default implementation provided by `UICollectionView` does not work correctly | ||
| /// when trying to move an item to the end of a section, or when trying to move an item into an | ||
| /// empty section. We should add casing that allows moving into the section in these cases. |
There was a problem hiding this comment.
I'm okay either way. I lean towards removing since we don't have a good repro on file. I did some local testing and haven't run across these reordering issues on iOS 16 or iOS 26, so the issue may be fixed!
## What's Changed * Add layout-aware drop targeting for custom layouts by @gabreho in #605 ### Checklist Please do the following before merging: - [x] Ensure any public-facing changes are reflected in the [changelog](https://github.com/square/Listable/blob/main/CHANGELOG.md). Include them in the `Main` section.
Describe your changes here. Please include screenshots if they're visual!
This change allows custom ListLayout implementations to override
drop target determination during interactive item reordering.
Checklist
Please do the following before merging:
Mainsection.