Giter Club home page Giter Club logo

vipermovieapp's Introduction

ViperMovieApp

This is a demo Movie Browsing app written with VIPER Architecture.

About VIPER

Viper Components

Each VIPER module consists of the following parts:

  • View (View, ViewController)
  • Interactor (Business Logic, Use Cases)
  • Presenter (Prepare Business logic for presentation in the View)
  • Entity (Model)
  • Router (Assemble each module and Take control of Routing)

Dependency Graph

The dependence graph is unidirectional, which means: View knows about Presenter Presenter knows about Router and Interactor Interactor communicates with Database/Repository. It is like an onion. The outer layers are dependent on the closest inner layer. And the inner layers have no knowledge of the outer layers.

Dependency Inversion (Feedback Loop)

However, when we want to inform the outer layer changes of the inner layer, a feedback channel needs to be created to bring info from inside of the onion out. This can be achieved in several ways. Using Rx Binding, closure (blocks) or like what we do here, using delegates (protocols).

We use ViewInterface to communicate back from Presenter to View and InteractionOutput to communicate back from Interactor to Presenter.

About the Demo App

It is a simple app which fetches movies and display them in collectionview. When the user taps on a movie, it shows movie detail and a "Favorite" button. User can mark their favorites in the detail page and consequently the changes will be shown in the collectionview.

There are in total 2 VIPER modules: movieList and movieDetail at this moment.

The UI appearance of this app is currently under construction ๐Ÿ˜‚

Unit Testing

One advantage of VIPER is that it makes unit testing so much easier! We have been able to fully test Interactor, Presenter, Entity and Router.

Module Generation

VIPER comes with a lot of boilplate codes. We have created a script to generate the most basic viper modules https://github.com/SwiftTsubame/TsubameVIPER.git. This script will also be further improved according to the evolution of our understanding of VIPER.

TODO:

  1. Implement more real-life like UI
  2. Allow other user interactions such as "sorting", "filtering"
  3. A lot more to come

Contact:

I am still in the process of digesting clean architecture and how it can be applied in iOS. If you have any suggestion or questions, please submit a PR or drop me a message at @haiyan_nest on Twitter :)

vipermovieapp's People

Contributors

swifttsubame avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vipermovieapp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.