Code Monkey home page Code Monkey logo

marvelheroesapp's Introduction

MarvelHeroesApp

Sample app that consumes the Marvel API. Using UIKit and Swift.

Description

The app consumes the Marvel API to display a list of Marvel characters. The user can select a character from the list and go to a details page, where more information from the character is shown.

App Features

  • Networking: The Home Screen displays a list of characters that is loaded from the endpoint /v1/public/characters. If there is and error on the first load, the user can retry as many times as needed without having to repoen the app.
  • Pagination: The user can scroll the list and more characters will be loaded every time the bottom of the list is reached.
  • Navigation: The user can select a character and navigate to a detail, where more info from the characters is displayed.

Architecture

I used Model View Presenter + Coordinator for the app. This mix of patterns allows me to write testable code from the begining, mainly focusing on testing the model entities and the presenters. If enforces a clear separation of concerns, helping to keep views as simple as possible, and encapsulating the business logic in the presenters. The Coordinator pattern suggests to use a coordinator class to handle navigation logic, taking that responsibility away from the view controllers.

Third party libraries

I'm comfortable writing UI programmatically, and i use Pure Layout to manage all the logic related to auto layout. I have been using this library for many years, and if find it simple to use and very powerful.

For image loading, i use Kingfisher. It has many built in features for image downloading and for caching, and since it adds an extension to UIImageView, it's pretty straightforward to use.

For networking, i choose Moya. I have seen and implemented myself very different ways to handle networking, and i believe that with Moya, there are many advantages. I specially appreciate the use of enums with values for each endpoint, because it helps to keep the code simple and easy to understand and mantain.

Last but not least, i like to use JGProgressHUD to display a simple and highly customizable loader.

Features i would like to add:

  • Search: i think this could be a very useful feature. The same endpoint that loads the characters must be used for this features, so this adds a little bit of complexity to the network layer (it already supports pagination). Maybe it could be better to try it as a separate endpoint.
  • Custom transition from home screen to detail screen.
  • More information about the character on the detail screen.
  • Offline support with Core Data. This will add more complexity to the code, so i believe that an extra layer of abstraction will be needed, a DataProvider. The Presenters will ask the DataProvider for the information that they need, and the DataProvider will decide if it loads it from the network, or loads it from the device storage.
  • Grid view for the home. Currently, the characters are displayed on a list. I would like to add a grid view, and let the user choose which view he/she prefers.

marvelheroesapp's People

Contributors

nahueldeveloper avatar

Watchers

 avatar

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.