Skip to content

refactor the two existing switch statements into polymorphic dispatch#2

Open
mbaranowski wants to merge 1 commit intoluketomlinson:masterfrom
mbaranowski:refactorSwitches
Open

refactor the two existing switch statements into polymorphic dispatch#2
mbaranowski wants to merge 1 commit intoluketomlinson:masterfrom
mbaranowski:refactorSwitches

Conversation

@mbaranowski
Copy link
Copy Markdown

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
Copy Markdown

mbaranowski:refactorSwitches

@zz321431
Copy link
Copy Markdown

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