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

Add a parameter: UI.bind(self) { me, state in ... } #5

Closed
beeth0ven opened this issue May 14, 2017 · 1 comment
Closed

Add a parameter: UI.bind(self) { me, state in ... } #5

beeth0ven opened this issue May 14, 2017 · 1 comment

Comments

@beeth0ven
Copy link
Contributor

Hi thanks for provide the simplest architecture for RxSwift with RxFeedback,
I've a small question, is it good to add a strongify self parameter like what UIBindingObserver dose.
This can avoid let label = self.label! :

//let label = self.label!
//let minus = self.minus!
//let plus = self.plus!

Observable.system(
    ...
    feedback:
        UI.bind(self) { me, state -> UI.Bindings<Event> in
            let subscriptions = [
                state.map(String.init).bind(to: me.label.rx.text)
            ]
            let events = [
                me.plus.rx.tap.map { Event.increment },
                me.minus.rx.tap.map { Event.decrement }
            ]
            return UI.Bindings(subscriptions: subscriptions, events: events)
        }
    )
    .subscribe()
    .disposed(by: disposeBag)
@beeth0ven beeth0ven changed the title Feature request UI.bind(self) { me, state in ... } Add a parameter: UI.bind(self) { me, state in ... } May 14, 2017
@kzaher
Copy link
Member

kzaher commented May 15, 2017

Hi @beeth0ven ,

yeah, sure. Feel free to make a PR with another overload.

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