Comments (2)
Hi! Sorry for the very late response.
I don' get why you need concurrent dispatches. Isn't it enough some like this (very simplified example code):
State & Actions:
enum DownloadState {
case notStarted
case progress(Double)
case done
}
// mediaID is a string or something
let media: [MediaID: DownloadState]
struct DownloadMedia: AsyncAction, ActionWithSideEffect {
let id: MediaID
// update states to handle start, progress and completion
sideEffect() {
let progressClosure = { progress in
dispatch(self.progressAction({ $0.progress = progress })
}
let completionClosure = { localURL in
dispatch(self.completionAction({ $0.progress = progress })
}
dependencies.apiManager.getMedia(self.id, progressClosure, completionClosure)
}
}
Actions are always sequential, but it doesn't matter because the download is actually parallel if yiu dispatch many DownloadMedia
.
For the UI you can attach a listener to the store in the vc that handles the collection/table of bubbles instead of using a listener for each bubble.
Take a look at Tempura, if you haven't seen it https://github.com/BendingSpoons/tempura-swift
I hope it is more clear now
from katana-swift.
@bolismauro , failed to receive notifications from your reply. Thanks a lot for the explanation. I would have a try of this framework. For Reswift, we need to manaage the serial queue manually to make sure all actions dispatched are in the same serial queue to make sure they are sequential
from katana-swift.
Related Issues (20)
- Improve state mocking
- Managed children of native view don't update correctly in collectionviews
- Store queue management should be refactored
- Katana Refs
- undefined is not an object (evaluting 'Proptypes.number') HOT 2
- Fail carthage build HOT 1
- Dead links in README HOT 2
- ChangeLog.md Request
- Are there any drawbacks to having a mutable store? HOT 1
- Interface Builder HOT 1
- Reduce boilerplate in Actions HOT 7
- [experimental] Catching errors when dispatching HOT 2
- [experimental] ObserverInterceptor items executed more than once HOT 1
- StoreListener change HOT 4
- Katana for SwiftUI HOT 1
- Can't build with Carthage HOT 2
- Provide Sample Project HOT 1
- SPM Installation (v4.0.0) failed
- Update Swift version HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from katana-swift.