New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Middleware guide #342
Comments
Maybe you could be the one missing contributor to a Middleware guide? :) I'd be happy to help. CreationTo get started, creating a simple Middleware with the nested closures looks like this: import Foundation
import ReSwift
let loggingMiddleware: Middleware<AppState> = { dispatch, getState in
return { next in
return { action in
print("> \(action)")
next(action)
}
}
} Basics
|
For this topic, I made simple tools and I called it ReSwiftMiddleware. A simple example of how to use this
If you need to interrupt the flow, you return The example of implementing
Now an example of how to connect this collection to [ReSwfit]
|
Hi, @Tavernari. Note that this would have some limitations compared to “normal” ReSwift middleware functions, maybe you want to add them in the README:
Sent with GitHawk |
Hi @danielmartinprieto, Thanks for the observations, I made some updates on version 0.1.2 and now I think it's not more obsolete and you can dispatch action direct from inside the
|
@Tavernari I was extremely confused with ReSwiftMiddleware because it's just a function which makes it not easy to use dependency injection for testing purposes. I am using your MiddlewareExecutor and it helped me greatly to both understand the general concept and with my testing. |
@atacengiz My idea on this framework is to help developers to use I hope to help many others to use |
I am trying to learn how to do middleware, but I cannot see any good resources to learn from.
I checked:
Can someone help?
The text was updated successfully, but these errors were encountered: