Giter Site home page Giter Site logo

rxmvvm's Introduction

rxmvvm

playground for using rx swift and combine with mvvm approach

WARNING: you need a proper Yelp API key to play with the demo, otherwise app will crash asking for it!

basic app structure

dependencies (via cocoapods)

  • using RxSwift
  • using RxMKMapView

network layer

network is built to abstract from the implementation, I've used URLSession concept of tasks as a high level concept, and it plays well with the most of network implementations we have now for iOS, so, we can use either URLSession itself, or Alamofrie, or something else to cover our network needs.

Goal on networking layer is to introduce also a concept of endopoints: therefore, we will be able to create and test requests without need of creating and testing network layer implementation, only "our" part. Now you can see we're creating URLRequest for network in the RestaurantsDataSource class, which is not that bad, but might be overhead in case of complex requests, security considerations, etc.

data sources

Data sources are designated to manipulate low-level data transfers (via network or files, user defaults, ect) and should incapsulate parsing/serialization logic, data mingling, scoped with concrete need. This app is reading data from Yelp, so, all communication with Yelp is behind RestaurantsDataSource class. Also, pay attention RestaurantsDataSource is using an abstraction of network, so, we can test data source independently, also we can swap networking for something else (like files) if we want it.

view models

View models should incapsulate the knowledge about it's data sources, and how to load/store data. Also, it's a nice place to provide default data for the case when data source is not yet ready, or we have some delays loading.

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.