GithubHelp home page GithubHelp logo

recombine / recombine Goto Github PK

View Code? Open in Web Editor NEW
48.0 4.0 5.0 256 KB

A Swift Redux library utilizing Apple's Combine Framework.

Home Page: https://ReCombine.io

License: MIT License

Swift 100.00%
redux-framework swift combine-framework swiftui

recombine's Introduction

ReCombine Logo

Simple. Performant. Native.

Swift Platform support License MIT

A Swift Redux Library utilizing Apple's Combine Framework.

Documentation

See the full documentation on ReCombine.io

Why ReCombine?

  • Simple
  • Performant
    • ๐Ÿš€ Uses Combine, boosting performance in comparison to Redux libraries that use RxSwift.
    • ๐Ÿฆ Implements performance optimizations for you, including memoized selectors.
  • Native
    • ๐Ÿ“ฒ Interacts seemlessly with SwiftUI.
    • ๐Ÿ›  Only depends on Combine under the hood.

Inspiration

The API is inspired by NgRx, Angular's most popular Redux framework.

recombine's People

Contributors

caseycavanagh avatar jtcrowson 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

Watchers

 avatar  avatar  avatar  avatar

recombine's Issues

Allow registration of Effects after the creation of the Store

This is useful for:

  • Effects that should not process for the entire lifetime of the Store instance.
  • Effects that need to capture a particular scope in it's closure.

Possible Usage:

class Model: ObservableObject {
     @Published var showAlert: Bool = false
     private var cancellableSet: Set<AnyCancellable> = []

     init(store: Store<State> = store) {
         let showAlert = Effect(dispatch: false) { actions in
             actions.ofType(GetPostError.self)
             .handleEvents(receiveOutput: { [weak self] action in
                 self?.showAlert = true
             })
             .eraseActionType()
             .eraseToAnyPublisher()
         }
         store.registerEffect(showAlert).store(in: &cancellableSet)
     }
 }

Add Testing Documentation

Add documentation for MockStore. The following should be covered:

  • Testing Reducers
  • Testing Selectors
  • Testing Effects
  • Testing Store-dependent classes

Support CocoaPods and Carthage

Currently only SPM is supported.

TODO:

  • Add support for CocoaPods
  • Add support for Carthage
  • Add documentation in docs-source/Installation.md

Create logo for ReCombine

Let's add a logo for ReCombine. It should be uploaded to the github CDN (just drag the image into a comment below) then add the url as an image to the top of README.md (there's one already there, just replace it)

Registering effects, how to scale properly?

As someone who's admittedly rather unfamiliar with Redux and its patterns, I never could quite figure out how it should scale properly. Pretty much all the examples I've seen consisted mostly of very simple apps (a counter appears to be the "classic" one).

I'm wondering how to scale this pattern properly for larger apps, in this case specifically, how I can deal with all the Effects I need to write a full-featured app?

For example, let's say I have an app with 4 tabs, each containing a navigation controller, that itself contains and a couple of child view controllers. Adding to this user/session handling (login/logout/register etc.). Each of these view controllers (20 or so) make network calls to different API endpoints to fetch their data and display it, I also need to deal with persistance on disk of a lot of the models, state restoration, etc.etc... My understanding is that each of these interactions (network calls, load/persist to disk etc.), in the context of ReCombine, should be an Effect... considering I have dozens of Effects (being fairly conservative here, hundreds is probably more accurate), and just the one global Store object where I can register them, should I just pass in a big list containing all the effects that these dozens of screens require when I initialize the store? Is there a better way to do this?

Looks like the way to mitigate this with reducers is to use the combineReducers functionality, is there something similar for Effects?

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.