Skip to content
This repository was archived by the owner on Apr 15, 2020. It is now read-only.

Made generic Item parameter a typealias in data source providers#25

Merged
jessesquires merged 2 commits into
jessesquires:developfrom
MrAlek:reduced-generic-parameters
Oct 22, 2015
Merged

Made generic Item parameter a typealias in data source providers#25
jessesquires merged 2 commits into
jessesquires:developfrom
MrAlek:reduced-generic-parameters

Conversation

@MrAlek
Copy link
Copy Markdown
Contributor

@MrAlek MrAlek commented Oct 19, 2015

Since the Item generic parameter in the data source providers is inferred by the Item types in cell, section & reusable view factories, it felt unnecessary to have to provide it when creating a data source provider.

This PR removed the generic parameter and adds it as a public typealias instead, to reduce verbosity while still keeping the type hierarchy clean.

@jessesquires
Copy link
Copy Markdown
Owner

@MrAlek -- Thanks! This is awesome. Excellent point. Great catch. 😄 ❤️

Wish this could have been included in 2.0 (just released) 😆

I'll merge soon.

@MrAlek
Copy link
Copy Markdown
Contributor Author

MrAlek commented Oct 19, 2015

Glad I could help and thanks for making the library :)

@jessesquires jessesquires self-assigned this Oct 20, 2015
@jessesquires jessesquires added this to the 3.0.0 milestone Oct 20, 2015
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Minor tweak: let's treat SectionInfo as "the source of truth". I view the Section as the data, not the CellFactory.

where SectionInfo.Item == CellFactory.Item, SectionInfo.Item == SupplementaryViewFactory.Item

Same change for the typealias, and add doc comments. 😄

/// The type of elements for the data source provider.
public typealias Item = SectionInfo.Item

@jessesquires
Copy link
Copy Markdown
Owner

Hey @MrAlek -- thought about this a bit more. Just a couple small comments to address!

@MrAlek
Copy link
Copy Markdown
Contributor Author

MrAlek commented Oct 20, 2015

@jessesquires I'll fix!

@MrAlek
Copy link
Copy Markdown
Contributor Author

MrAlek commented Oct 20, 2015

@jessesquires I also reversed the where clause expressions to avoid yoda-conditioning since the SectionInfo is the source of truth.

jessesquires added a commit that referenced this pull request Oct 22, 2015
Remove generic Item parameter in data source providers. It's superfluous.
@jessesquires jessesquires merged commit 9fcd0b5 into jessesquires:develop Oct 22, 2015
@jessesquires
Copy link
Copy Markdown
Owner

Thanks @MrAlek ! 👍

@MrAlek MrAlek deleted the reduced-generic-parameters branch May 14, 2016 14:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants