recombine / recombine Goto Github PK
View Code? Open in Web Editor NEWA Swift Redux library utilizing Apple's Combine Framework.
Home Page: https://ReCombine.io
License: MIT License
A Swift Redux library utilizing Apple's Combine Framework.
Home Page: https://ReCombine.io
License: MIT License
Let's add a state management diagram, similar to NgRx.
This is useful for:
Store
instance.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)
}
}
See https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started for instructions.
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?
Currently only SPM is supported.
TODO:
docs-source/Installation.md
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)
Split MockStore into a separate package to allow them to be pulled on a as-needed basis.
Add documentation for MockStore
. The following should be covered:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.