Skip to content

Adding peek support to PagedListLayout #560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Apr 4, 2025

Conversation

johnnewman-square
Copy link
Contributor

@johnnewman-square johnnewman-square commented Mar 18, 2025

  • PagedListLayout now supports a peek value, which allows items to peek into view from the leading/top and trailing/bottom edges.
    • The peek can be disabled, uniform on both sides, or have a unique first item leading peek.
    • The layout's PagingSize now supports inset(Peek) and fixed(CGFloat) page sizes.
  • Replacing the isPagingEnabled boolean with a PageScrollingBehavior enum. This gives layouts the ability to disable paging, leverage full UIScrollView paging (where items are full width), or use peek paging (where items can be less than the full width and peek into view).
  • ListScrollPositionInfo now contains the percentage of visibility for each visible item. This allows clients to pick the most visible item for selection.

Checklist

Please do the following before merging:

  • Ensure any public-facing changes are reflected in the changelog. Include them in the Main section.
Simulator.Screen.Recording.-.iPad.mini.A17.Pro.-.2025-03-18.at.13.27.11.mp4

@johnnewman-square johnnewman-square marked this pull request as ready for review March 18, 2025 17:50
@johnnewman-square
Copy link
Contributor Author

To ensure CI is working, this PR includes the actions/cache v4 changes from #561.

@johnnewman-square johnnewman-square marked this pull request as draft March 24, 2025 14:46
@johnnewman-square johnnewman-square force-pushed the johnnewman/feature/inset-items branch from df39807 to 9d6e28e Compare March 24, 2025 22:17
@johnnewman-square johnnewman-square force-pushed the johnnewman/feature/inset-items branch from 224474a to 70a3f32 Compare March 25, 2025 19:41
@johnnewman-square johnnewman-square marked this pull request as ready for review March 25, 2025 20:28
Copy link
Contributor

@maxg-square maxg-square left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple questions but this looking great overall!

Copy link
Collaborator

@kyleve kyleve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (I think), nice work! I want to think through the ListLayout changes a bit more, but they look right to me

Copy link
Collaborator

@nsillik nsillik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple of comments, looking great though!

@johnnewman-square johnnewman-square force-pushed the johnnewman/feature/inset-items branch from 8a2cab7 to 38e94c5 Compare March 28, 2025 20:11
* main:
  Updating actions cache version (#561)
* main:
  Update run_tests.yml
  Update run_tests.yml
  Update run_tests.yml
  Update run_tests.yml
  Update run_tests.yml
  Update run_tests.yml
  Update env.properties
  Update run_tests.yml
  Prepare 15.0.2 release (#564)
  Update Xcode verison
  Update to use runner
  Add env var for macos runner
  Update SPM job to use env var
  Fix for crash when doing a programmatic scroll down while another external update is processed (#557)
  bug: Disable cell content interaction while swipe actions are visible. (#562)
@johnnewman-square johnnewman-square merged commit e8fdd20 into main Apr 4, 2025
4 checks passed
@johnnewman-square johnnewman-square deleted the johnnewman/feature/inset-items branch April 4, 2025 15:17
johnnewman-square added a commit that referenced this pull request Apr 4, 2025
This release adds peek support for the `PagedListLayout` from
#560.
kyleve added a commit that referenced this pull request Apr 15, 2025
…-headerfooters

* origin/main:
  release: Prepare 16.0.0 release (#567)
  Adding peek support to `PagedListLayout` (#560)
kyleve added a commit that referenced this pull request Apr 15, 2025
In #560 we introduced a
`percentageVisible` property on our list position info to support
peek-based page layouts – this is usually fine, but due to event
ordering, and namely how it takes an extra runloop for the collection
view layout to update after `collectionView(_ collectionView:
UICollectionView, moveItemAt from: IndexPath, to: IndexPath)` is called,
we end up in a state where the list's storage is inconsistent with its
layout. This means that our call to
`ListStateObserver.perform(self.view.stateObserver.onItemReordered,
"Item Reordered" ...)` would crash / be wrong until the layout occurred.
The fix is to place the `Item Reordered` observer callback at the end of
the update queue, so the collection view has time to "settle" internally
and become consistent.

[Relevant Slack
Thread](https://square.slack.com/archives/CTJ4UNLHF/p1744750475867669)

https://block.atlassian.net/browse/UI-8607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants