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

Provide rex_prepareForReuse for UITableView and UICollectionView components #104

Conversation

dmcrodrigues
Copy link
Contributor

Now that we have rex_toTriggerSignal, thanks to @RuiAAPeres, we may bring a swifty version of rac_prepareForReuseSignal. It's only syntactic sugar but it can be quite useful.

Example:

self.label.rex_text <~
    titleProperty
       .producer
       .takeUntil(self.rex_prepareForReuseSignal)

@dmcrodrigues
Copy link
Contributor Author

In case of positive feedback about adding this I can extend it to UICollectionView's components.

@neilpa
Copy link
Member

neilpa commented Apr 20, 2016

👍 on the idea. I'd go with rex_prepareForReuseTrigger for the name though (or maybe just rex_prepareForReuse).

@RuiAAPeres
Copy link
Member

I like rex_prepareForReuse, so the naming is not tied to a usage context.

@dmcrodrigues
Copy link
Contributor Author

I agree, rex_prepareForReuse seems a good option. I'll update the PR accordingly and extend it to also include each component of UICollectionView.

@dmcrodrigues
Copy link
Contributor Author

@RuiAAPeres @neilpa I noticed that there are other signals using this convention rex_{name}Signal, e.g. rex_willDeallocSignal or rex_viewDidDisappearSignal, and they all share the same signature. Should we also change them to promote consistency?

@RuiAAPeres
Copy link
Member

I agree. Open a new PR for that.

@dmcrodrigues
Copy link
Contributor Author

I adopted another approach to provide this, instead of having the same property in each class I created a protocol Reusable and using protocol extensions I shared the implementation of rex_prepareForReuse between each class. I think this can be beneficial to avoid repeating exactly the same code over and over.

@dmcrodrigues dmcrodrigues changed the title Added rex_prepareForReuseSignal for UITableView's components Provide rex_prepareForReuse for UITableView and UICollectionView components Apr 20, 2016
//

import Foundation
import ReactiveCocoa
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove Foundation, for simplicity sake ( #103 )

@dmcrodrigues
Copy link
Contributor Author

All fixed (I think) 🔎

@RuiAAPeres
Copy link
Member

Awesome! 👍

@RuiAAPeres RuiAAPeres merged commit 5e76180 into RACCommunity:master Apr 20, 2016
@dmcrodrigues dmcrodrigues deleted the dr/uitableview-prepare-for-reuse-signal branch April 20, 2016 22:29
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.

3 participants