Skip to content
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

Add FlatSection #21

Open
wants to merge 52 commits into
base: 2.0-beta
Choose a base branch
from
Open

Add FlatSection #21

wants to merge 52 commits into from

Conversation

JosephDuffy
Copy link
Member

@JosephDuffy JosephDuffy commented Dec 22, 2020

This is a new type of section that is similar to ComposedSectionProvider, but rather than flattening each of the children in to a single SectionProvider it flattens them in to a single Section.

The ComposedUI side of this has been updated to support multiple cells per section, with a convenience for FlatSection that delegates the calls to each of the flattened sections.

This is a breaking change since the protocol requirements have changed. I have set the base of the PR to merge-all-libraries since that's also a breaking change and this PR relies on those changes.

edit: We've moved to our own fork to allow for more rapid development. The latest changes are in https://github.com/opennetltd/Composed/tree/feature/FlatSection, which will eventually be merged back in to this repo once some of the other PRs/issues have been resolved.

JosephDuffy and others added 21 commits December 22, 2020 15:51
Still a little hacky, more like a POC, but is overall much more flexible
…atSection

# Conflicts:
#	Sources/ComposedUI/CollectionView/CollectionCoordinator.swift
# Conflicts:
#	Sources/ComposedUI/CollectionView/CollectionCoordinator.swift
Mirror(
self,
children: [
"children": children,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see your trickery haha

@shaps80
Copy link
Collaborator

shaps80 commented Jan 4, 2021

this is really interesting but I'm not 100% understanding its need. Im all for it, just would love to understand how you came to it 👍

@JosephDuffy
Copy link
Member Author

this is really interesting but I'm not 100% understanding its need. Im all for it, just would love to understand how you came to it 👍

The latest changes (https://github.com/opennetltd/Composed/tree/feature/FlatSection) account for a header. We have multiple Sections that are flattened and have a single header inserted by the flat section, which allows the same header to be pinned to bounds for multiple Sections (because the collection view sees it as a single section).

There are still some downsides so we might need a few runtime warnings (e.g. that the headers and footers of the children of the flat section are ignored). I'm happy to keep this open an keep iterating on it until some of these issues are improved though.

@shaps80
Copy link
Collaborator

shaps80 commented Jan 4, 2021

ahh I see the point now. Interesting. Yeah lets keep it open as a PR for the moment, can you mark this as a draft.

# Conflicts:
#	Sources/Composed/Providers/ComposedSectionProvider.swift
#	Sources/ComposedUI/CollectionView/CollectionCoordinator.swift
}

public func mappingDidInvalidateFooter(at sectionIndex: Int) {
// TODO: Reload header
Copy link
Member Author

Choose a reason for hiding this comment

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

A future PR can cover the updates already made to UICollectionView, including batched updates.

@JosephDuffy JosephDuffy marked this pull request as ready for review January 19, 2021 18:17
@JosephDuffy
Copy link
Member Author

@shaps80 we've been using this for a while now and I'm not aware of any issues. It still ignores the headers and footers of children but I feel this is worthy of being classed as a functioning beta (and thus merged in to 2.0-beta).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants