samsao / DataProvider

Data provider is a library made to abstract Table and Collection views boilerplate code.
MIT License
14 stars 6 forks source link

Change ProviderDelegate to closure calls #3

Open GlisboaDev opened 8 years ago

GlisboaDev commented 8 years ago

In its current state the provider communicate tableview delegate methods trough ProviderDelegate protocol. The suggestion would be to change this protocol to use closures instead, having a more swift oriented approach. What are your thoughts on it?

GabrielCartier commented 8 years ago

I like this. I feel like it can provide a bit more flexibility and we could get rid of the ugly @objc protocol.

The question is, what closure should we allow the cells to have? didSelect, didDeselect? anything else?

GlisboaDev commented 8 years ago

I don't think the cells should have these closures. I'd see it as something in the provider. The provider hold the closure reference, its owner set them, and finally the provider DelegateHandler call them as needed. For me makes sense having didSelect and didDeselect as the base ones, since it's what it's mostly used. Other than that, if someone needs to add extra behaviour, the provider can be subclassed and added as necessary.

GabrielCartier commented 8 years ago

Agreed. Want to do it? I can merge it in

GlisboaDev commented 8 years ago

Yea, sure. I'll do it as soon as I get some time to work on provider