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

refactor the two existing switch statements into polymorphic dispatch #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mbaranowski
Copy link

switch statement in condigureCell is replaced with AnyCellConfigurable.configure which force-casts and calls the type-specific CellConfigurable.configure

we can assume all cells are of type AnyCellConfigurable because we register only using the cellTypes array, and that only allows AnyCellConfigurable.Type.

the switch statement in cellType(for:) is replaced by the fact that CellViewModelType has an associatedtype of the cell type is can configure.

switch statement in condigureCell is replaced with AnyCellConfigurable.configure which force-casts and calls the type-specific CellConfigurable.configure

we can assume all cells are of type AnyCellConfigurable because we register only using the cellTypes array, and that only allows AnyCellConfigurable.Type.

the switch statement in cellType(for:) is replaced by the fact that CellViewModelType has an associatedtype of the cell type is can configure.
@katukatr
Copy link

mbaranowski:refactorSwitches

@zz321431
Copy link

jlord/sheetsee.js#26

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