Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What does this userInput() do? #9

Open
mgai opened this issue Mar 28, 2021 · 1 comment
Open

What does this userInput() do? #9

mgai opened this issue Mar 28, 2021 · 1 comment

Comments

@mgai
Copy link

mgai commented Mar 28, 2021

Hi Vadim and all experts,

Thank you very much for your great tutorial. I have a question here is, the userInput() feedback seems just pass through the input without doing anything. If this is the case, why do we still reed it?

Also another question is, for multiple feedbacks, are they processed in parallel or sequential? Or as for declarative principle, we should not care about the order and they should be independent?

Thank you for your answer, and take care in this challenging time.

Cheers,
Ming

@mgai
Copy link
Author

mgai commented Apr 18, 2021

OK, after a while, I think I kinda figured them out myself -

userInput

It just pass through the event to the subscribers, for further processing by reducer if needed, to see if it should be picked up for state change.

    private let input = PassthroughSubject<Event, Never>()
//...
                Self.userInput(input: input.eraseToAnyPublisher())

Multiple feedback processing

It's done by the map call one by one (well, it's in fact clearly illustrated in the diagram on the tutorial page...), as defined in the System -

        let events = feedbacks.map { feedback in feedback.run(state.eraseToAnyPublisher()) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant