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 better API for Disposable when adding to DisposeBag #1079

Merged
merged 5 commits into from
Jan 22, 2017

Conversation

andyyhope
Copy link
Contributor

Added

I brought up in the Slack channel that the original Disposable API .addDisposableTo(_ bag: DisposeBag) felt out of line with the newly minted Swift API guidelines.

Because an Observable returns a Disposable after using the subscribe API, it makes no sense to treat the Disposable API like it's an Observable.

After some discussion in the channel, the group generally favored disposed(by bag: DisposeBag) to eventually replace addDisposableTo, which is why we've created it as an extension for the time being. People will be able to slowly transition from the old API to the new without being under duress.

The new APIs implementation is merely a wrapper around the old. I wrote it this way because I felt keeping one implementation of it would be beneficial, at least until the old one gets deprecated (if it ever will).

Old API

.addToDisposeBag(disposeBag)

New APU

.disposed(by: disposeBag)

@RxPullRequestBot
Copy link

RxPullRequestBot commented Jan 22, 2017

        1 Warning
    
  </th>
 </tr>
⚠️ No CHANGELOG changes made

Generated by 🚫 danger

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

Successfully merging this pull request may close these issues.

None yet

3 participants