Skip to content

Refactor ImmuTablePresenter/Controller/VC - #4788

Closed
koke wants to merge 1 commit into
developfrom
fix/refactor-immutable-presenter
Closed

Refactor ImmuTablePresenter/Controller/VC#4788
koke wants to merge 1 commit into
developfrom
fix/refactor-immutable-presenter

Conversation

@koke

@koke koke commented Feb 8, 2016

Copy link
Copy Markdown
Member

The main goal is to remove visible from ImmuTablePresenter, since it
doesn't really belong there. Presenter is a thing that can "present" view
controllers: usually a UIViewController, but implemented as a protocol so it's
testable.

But then I realized, the Controller doesn't really need a reference to
Presenter, or the parent View Controller. The only thing that needs that is
ImmuTable (for the callbacks), and we can pass the presenter when requesting
the table view model (renamed). This is similar to the previous solution, but
avoids the chicken-and-egg problem when initiailizing. And because of this, it
removes 4 assertions/preconditions that are now guaranteed at compile time.

The visible observable is still exposed on ImmuTableViewController, but
the VC is the one pausing the subscription to tableViewModel and errorMessage,
instead of relying on the controller. I like this slightly less semantically,
but it makes everything much simpler with initialization.

Needs Review: @frosty

The main goal is to remove `visible` from `ImmuTablePresenter`, since it
doesn't really belong there. Presenter is a thing that can "present" view
controllers: usually a UIViewController, but implemented as a protocol so it's
testable.

But then I realized, the Controller doesn't really need a reference to
Presenter, or the parent View Controller. The only thing that needs that is
ImmuTable (for the callbacks), and we can pass the presenter when requesting
the table view model (renamed). This is similar to the previous solution, but
avoids the chicken-and-egg problem when initiailizing. And because of this, it
removes 4 assertions/preconditions that are now guaranteed at compile time.

The `visible` observable is still exposed on ImmuTableViewController, but
the VC is the one pausing the subscription to tableViewModel and errorMessage,
instead of relying on the controller. I like this slightly less semantically,
but it makes everything much simpler with initialization.
@koke koke added this to the 6.1 milestone Feb 8, 2016
@frosty

frosty commented Feb 8, 2016

Copy link
Copy Markdown
Contributor

Still getting my head around RxSwift, but this all looks good to me.

:shipit:

@koke

koke commented Feb 8, 2016

Copy link
Copy Markdown
Member Author

I merged #4740 earlier and it changes a lot of My Profile. I'll probably redo this changes on top of that

@koke

koke commented Feb 8, 2016

Copy link
Copy Markdown
Member Author

Re-done this on #4791

@koke koke closed this Feb 8, 2016
@koke
koke deleted the fix/refactor-immutable-presenter branch February 8, 2016 16:37
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.

2 participants