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

Auto cell registration + unify table and collection views #98

Merged
merged 2 commits into from
Jan 28, 2018

Conversation

jessesquires
Copy link
Contributor

Rather than copy-pasta table view code for collection view, let's unify them.

This introduces CellParentViewProtocol to reduce duplication in auto-registering cells. It unifies the APIs of tables and collections.

On top of this, we add ReusableCellProtocol and ReusableSupplementaryViewProtocol to unify our cell view models and supplementary view models.

Now there's a single API for registering cells automatically.

All work based on:
https://github.com/jessesquires/JSQDataSourcesKit/blob/develop/Source/ReusableViewConfig.swift

Almost completes #18, starts initial work on #46

For `UICollectionViewCell`, this would be `UICollectionView`.
For `UITableViewCell`, this would be `UITableView`.
*/
protocol CellParentViewProtocol {
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you feel about Container versus Parent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤷‍♂️

either works for me

Copy link
Contributor

Choose a reason for hiding this comment

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

Also like container :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will update!

Copy link
Contributor

@anayini anayini left a comment

Choose a reason for hiding this comment

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

This is great!

Copy link
Contributor

@Ben-G Ben-G left a comment

Choose a reason for hiding this comment

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

Beautiful 👏👏👏

For `UICollectionViewCell`, this would be `UICollectionView`.
For `UITableViewCell`, this would be `UITableView`.
*/
protocol CellParentViewProtocol {
Copy link
Contributor

Choose a reason for hiding this comment

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

Also like container :)

public protocol ReusableSupplementaryViewProtocol {

/// The registration info for the supplementary view.
var viewInfo: SupplementaryViewInfo? { get } // TODO: make this not optional
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you avoiding addressing this TODO now to keep this PR reasonably sized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct. will follow-up

Rather than copy-pasta table view code for collection view, let's unify them.

This introduces `CellParentViewProtocol` to reduce duplication in auto-registering cells. It unifies the APIs of tables and collections.

On top of this, we add `ReusableCellProtocol` and `ReusableSupplementaryViewProtocol` to unify our cell view models and supplementary view models.

Now there's a single API for registering cells automatically.

All work based on:
https://github.com/jessesquires/JSQDataSourcesKit/blob/develop/Source/ReusableViewConfig.swift

Almost completes #18, starts initial work on #46
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.

3 participants