By following this approach added a mutating func into the Child and got the error
// Path.State does not contain mutating func
case let .element(id: id, action: …):
state.path[id: id]?.someMutatingFunc()
// Cast from 'ContentFeature.Path.State?' to unrelated type 'SettingsFeature.State' always fails
case let .element(id: id, action: …):
if let settingsState = state.path[id: id] as? SettingsFeature.State {
settingsState.someMutatingFunc()
}
return .none
Also documentation recommends another approach, is this working with navigation stack?
case .buttonTapped:
return Child().reduce(into: &state.child, action: .refresh)
.map(Action.child)
Tried something like:
return SettingsFeature()
.reduce(into: &state.path[id: id]!, action: .updateSettings)
.map(Path.Action.settings)
any suggestion?