Hi, for the last few days, I've been trying to pull the RxSwift version of ComposableArchitecture from our internal codebase. We are trying to write some of our features using this architecture, which will be released in a few weeks. I want to bring it to the open, hoping that it can be useful to some of us here, also getting feedbacks. so that the library is more battle-tested.
The library is currently optimized for UIKit. I have no intention to support SwiftUI for now because if you're using SwiftUI, you would use Combine instead, right?
Some notable differences compared to the original:
- It uses
Driver
instead ofEffect
type so that actions from side effects will always be delivered to the main thread. - Has no
ViewStore
. ViewStore was created for ergonomic reasons in SwiftUI and since SwiftUI is not supported, there's no reason for it to exist. - To subscribe to state updates, you can use the
subscribe
method
class Store<State, Action> {
public func subscribe<LocalState: Equatable>(
_ toLocalState: @escaping (State) -> LocalState
) -> Driver<LocalState>
}
struct Person {
var name: String
}
store
.subscribe(\Person.name)
.drive(label.rx.text)
.disposed(by: disposeBag)
If there are enough people interested in using RxSwift version of TCA, I'll be more serious in maintaining this .