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

Return Bindings instead of tuple #1

Closed
sergdort opened this issue May 8, 2017 · 1 comment
Closed

Return Bindings instead of tuple #1

sergdort opened this issue May 8, 2017 · 1 comment

Comments

@sergdort
Copy link

sergdort commented May 8, 2017

I feel like it would make code more readable if we return Bindings instead of tuple?

  • highlight intention for the consumer of the API.
func bind<State, Event>(_ bindings: @escaping (Observable<State>) -> (Bindings) -> (Observable<State>) -> Observable<Event>
  • make user API more readable
    func makeBindings(for state: Observable<State>) -> Bindings<Event> {
        let subscriptions = [
            state.map(String.init).bind(to: label.rx.text)
        ]
        let events = [
            plus.rx.tap.map { Event.increment },
            minus.rx.tap.map { Event.decrement }
        ]
        return Bindings(subscriptions: subscriptions, events: events)
    }
}

Thoughts ?

@kzaher
Copy link
Member

kzaher commented May 11, 2017

Hi @sergdort ,

yeah, that would be great. Feel free to open a PR.

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

2 participants