Comments (7)
Hi!
Thanks for the input. You're completely right and we are aware of this problem. We decided 2 years ago to don't use that approach because of the issues with PAT and all the additional complications that they bring on the table. Moreover, it creates also some issues when it comes to Modularization and actions offered by libraries.
We are exploring different approaches for the next version of Katana, but in the meanwhile what we do it to use an additional protocol like this
protocol AppAction: Action {
func updatedState(currentState: inout AppState)
}
extension AppAction {
public func updatedState(currentState: State) -> State {
guard var state = currentState as? AppState else {
fatalError()
}
self.updatedState(currentState: &state)
return state
}
}
You can do the same thing for the AsyncAction
. It is not perfect for sure, but it is quite handy
from katana-swift.
an additional protocol like this
Maybe it's better to encourage this approach by adding some TypedAction: Action
protocol right to Katana instead of enforcing users to implement it by themselves.
Another place where boilerplate can be reduced a bit is AsyncAction
– default implementations for updatedStateFor...
methods can be added to protocol extension
func updatedStateFor...(currentState: State) -> State {
return currentState
}
next version of Katana
Any hint about when it may be released?
from katana-swift.
It is actually a good idea :) Feel free to open a PR!
For the next version, we are starting to discuss it in these days. Since we have several different priorities, we will try to figure out how to prioritise them. If Katana ends up "winning", I expect this to happen in the next months (1/2 max).
About a year ago I wrote an evolution proposal, which was very ELM oriented and very radical. You can find it here
https://github.com/bolismauro/katana-evolution
It may be that we will use some of that ideas, but for sure it will become 100% compatible with the current version as we have several tens of apps that use Katana and update them all together would be crazy
from katana-swift.
As discussed, the new katana experimental version offers typed versions of the actions (state updaters and side effects actually, actions have been separated).
We are developing a couple of apps using this experimental version, so it is not really production ready yet.
Thanks a lot for the input!
from katana-swift.
The link isn't working(
from katana-swift.
https://github.com/BendingSpoons/katana-swift/tree/experimental
sorry ;)
from katana-swift.
Thanks, I'll give it a look!
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
- Is there any co-currency management for a single store? HOT 2
- [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.