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

Introducing MviView interface, which ensures "render()" method implementation #258

Closed
regmoraes opened this issue Jun 29, 2017 · 1 comment

Comments

@regmoraes
Copy link

regmoraes commented Jun 29, 2017

Actualy, if we want to use the MVI library, we should make the View ( Activities and Fragments) implements the MvpView interface, and be sure to create and implement the render method, which takes a ViewState as parameter.

How about create a MviView typed interface that has a render(Type viewState) and extends MvpView? This way, every time we make a View implement the proposed MviView it's forced to override the render method.

Sugestion of implementation

public interface MviView<VS> extends MvpView {

    public void render(VS viewstate);
}

Usage example

public class MainActivity extends Activity implements MviView<SomeViewState> {

   (...)
  
   @Override
    public void render(SomeViewState viewstate){
     
     // Custom implementation
   }
}
@sockeqwe
Copy link
Owner

sockeqwe commented Jun 29, 2017 via email

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

No branches or pull requests

2 participants