We've used ReSwift in a few iOS projects and have been loving it. In 4.0, they added the ability to sub-select portions of the state and skipRepeats
, either manually or using a store that's Equatable. Subselecting a store is straightforward:
store.subscribe(subscriber) {
$0.select {
$0.testValue
}
}
Then you define newState
with:
func newState(state:TestValue) {
// handle new state
}
I'm a little stuck on how to define newState
when passing multiple parameters via a tuple:
store.subscribe(subscriber) {
$0.select {
($0.testValue, $0.otherState?.name)
}
}
I'm passing the tuple but seeing the Type 'MainViewController' does not conform to protocol 'StoreSubscriber'
and Type of expression is ambiguous without more context
errors:
func newState((testState: TestValue, name: String)) {
// handle new state
}
What am I doing incorrectly here?