Giter Club home page Giter Club logo

rxviewmodel's Introduction

RxViewModel

codecov.io Build Status Carthage compatible Version License Platform

Model-View-ViewModel

Model-View-ViewModel (MVVM from now on) was created by Microsoft and is defined as follows:

The Model-View-ViewModel (MVVM) pattern is an application pattern that isolates the user interface from the underlying business logic. MVVM belongs to a class of patterns called Separated Presentation. These patterns provide a clean separation between the UI and the rest of the application. This improves the testability of the application and allows the application and its UI to evolve more easily and independently.

The Model-View-ViewModel (MVVM) pattern helps you to cleanly separate the business and presentation logic of your application from its user interface (UI). Maintaining a clean separation between application logic and UI helps to address numerous development and design issues and can make your application much easier to test, maintain, and evolve. It can also greatly improve code re-use opportunities and allows developers and UI designers to more easily collaborate when developing their respective parts of the application.

It basically adds a new «separation layer» to break down the MVC pattern into more manageable pieces.

MVC on Cocoa hast always been a pain because it always translates to «Massive View Controller» due to the need to many delegates that are usually implemented by one controller (e.g. when binding a tableview where you need a delegate for the tableview and also a delegate for the data source, etc).

MVVM separates the View from the Model via an «intermediate» class named ViewModel.

This intermediate class allows the binding of the View and the Model in a more clean and easy manner and also separates some logic as to how/when to load the data removing that responsability from the View and leaving pretty much only the UI specific code in it.

RxViewModel

RxViewModel is the marriage between MVVM and Rx extensions

Long story short: a blatant «imitation» of ReactiveViewModel using RxCocoa.

Since ReactiveViewModel project felt on stagnation and there's not Swift or Swift 2.0 implementation we found the need to implement something like this on Swift.

Given the fact that there's no Swift branch and the lack of interest in the project we felt it was better to give RxSwift/RxCocoa a chance and instead use it as the base for this reactive view model approach.

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

CocoaPods

Simply add the following line to your Podfile:

pod "RxViewModel"

And then run:

pod install

Carthage

Just add the following to your Cartfile

github "RxSwiftCommunity/RxViewModel"

And run:

carthage update

Features

Currently RxViewModel supports the following features from ReactiveViewModel (*ALL of them 😉):

  • didBecomeActive
  • didBecomeInactive
  • forwardSignalWhileActive
  • throttleSignalWhileInactive

Author

Esteban Torres

License

RxViewModel is available under the MIT license. See the LICENSE file for more info.

rxviewmodel's People

Contributors

ashfurrow avatar ayastrebov avatar bobspryn avatar calvingit avatar dependabot[bot] avatar esttorhe avatar freak4pc avatar leoneparise avatar pixel16 avatar pixeldock avatar readmecritic avatar

Stargazers

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

Watchers

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

rxviewmodel's Issues

You should make RxViewModel class "open"

I have Cannot inherit from non-open class 'RxViewModel' outside of its defining module all around my project because of you annotate rxviewmodel class with "public" annotation instead of "open"

Carthage fails to build

I am seeing the following when trying to build with latest Carthage and 4.0 of RxViewModel:

Carthage/Checkouts/RxViewModel/Source/RxViewModel.swift:13:8: error: no such module 'RxSwift'
import RxSwift
       ^

** BUILD FAILED **

Cartfile.resolved

github "ReactiveX/RxSwift" "3.5.0"
github "RxSwiftCommunity/RxViewModel" "4.0.0"

CocoaPods Keywords

When I'm searching for MVVM on cocoapods.org, RxViewModel doesn't show up.

Adding that keyword somewhere in your podspec description might help discoverability 😉

Carthage minimum deployment target 8.3

It seems that iOs 8.3 is required with Carthage, I'm using RxViewModel in another project with Cocoapods and iOs 8.0 as deployment target and it works fine

Change CI provider

Given that TravisCI is pretty horrible and during #47 I was unable to grep or even read the failing logs…

Maybe it is time to re-consider a move of CI provider.
BuddyBuild or CircleCI are the ones that come to my mind but perhaps there are other that could be good to adopt.

RxCocoa dependency conflicts

Hey, u need update the RxViewModel.podspec file to support swift 2.0, RxCocoa have a new tag named 2.0.0-alpha.3

 s.dependency 'RxCocoa'
    #, :branch => 'feature/swift2.0' <<== commented out for now because we would be depending on Swift 2.0

Fix the CI

Currently Circle CI stopped giving us access to their OS X boxes.
Talked briefly with them over Twitter; need to send an email to sort out the issues.

Until then all PRs need to be locally tested before merging and admins should «override» the lock when merging a failing/non tested PR.

Update CI Settings

From #10

Either fix the settings on CircleCI or transition to TravisCI if CircleCI is no longer an option.

Can't use RxSwift 3.6.1

Can't use latest RxSwift, when installing with cocoapods. Only version 3.5.0 is supported now

Installing RxSwift 3.5.0 (was 3.6.1)

Unable to use when inherited

Install from Cocoapods, the Xcode shows below error message:

'disposeBag' is inaccessible due to 'internal' protection level

Fix broken CI

@ashfurrow pointed out on #15 that the CI is broken due to an issue with code coverage.

Already tried contacting CircleCI because is an issue with permissions but haven't heard from them just yet.

Fix Codecov.io

Right now the CI is correctly installing codecov but it's failing to find the coverage file and thus generating a coverage of 0.00% when in reality its around 80%

Retain cycle

When subclassing RxViewModel, I'm seeing a retain cycle with a lazy property observable chain that starts with didBecomeActive. I found what I thought was the issue and submitted PR #30, but I'm still seeing it.

    lazy var slotDriver: Driver<[PromotionsPage.Slot]> = {
        return self.didBecomeActive
            .mapReplace([])
            .asDriver(onErrorJustReturn: [])
    }()

RxViewModel is depending on an old version of RxCocoa

I got this error today when trying to pod install RxViewModel with RxCoreData -

[!] Unable to satisfy the following requirements:

  • RxCocoa (~> 1.8) required by RxViewModel (0.2.1)
  • RxCocoa (~> 2.5) required by RxCoreData (0.1.0)

Throttle

Is a must for my organization, what's the hold up here?

README for non-ReactiveCocoa devs?

The README says RxViewModel is a blatant copy of another library used with ReactiveCocoa. I however have never used ReactiveCocoa so no idea how to use that other library either.

Few code samples how to use RxViewModel and recommendations how/when to use will go a long way, please consider adding those to the repo README.

Finish up README

The README was in a «beautification» process when 2.1.1 was pushed to fix a minor issue.

Need to finish explaining what RxViewModel is so potential users won't need to check out another pod's page to know what this one is about.

Move to Org (RxSwiftCommunity)

RxSwiftCommunity

Prep:

  • Update podspecs with new remote URL (560fda8)
  • Update CI badge (560fda8)
  • Update CI settings See #12
  • Fork the repo back to my personal account (I really don't feel like sending a PR to fix CocoaPods trunk, forking is so much easier
    • This means the pod will still be maintained by me (in theory by anyone but for now i'll be pushing to trunk)

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.