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

[Proposal] React for Void? #57

Open
domasn opened this issue May 29, 2019 · 0 comments
Open

[Proposal] React for Void? #57

domasn opened this issue May 29, 2019 · 0 comments

Comments

@domasn
Copy link

domasn commented May 29, 2019

Hi there 👋

My company struggled a bit after 2.0 removed react for non-equatable types. I think, it's absolutely reasonable to to require types returned by request be equatable.

Though, we are using Void? in quite a few places to trigger feedback loops that don't require any parameters. Examples include anything from networking to navigation, from current location fetch to database sync.

We ended up writting a custom react just for this case:

func react<State, Event>(request: @escaping (State) -> Void?,
	                 effects: @escaping () -> Signal<Event>) -> (Driver<State>) -> Signal<Event> {
    return react(request: { request($0) != nil ? true : nil }, // Bool to the rescue 🙈
                 effects: { _ in effects() })
}

Do you think it would make sense to add a react for Void? to RxFeedback? Have you encountered this?

Thanks!

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