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

make isBuildingModels public #406

Merged
merged 2 commits into from
Mar 13, 2018
Merged

make isBuildingModels public #406

merged 2 commits into from
Mar 13, 2018

Conversation

anasanasanas
Copy link
Contributor

@anasanasanas anasanasanas commented Mar 11, 2018

make isBuildingModels public instead of package access to create custom TypedEpoxyController.

when creating custom Typed5EpoxyController that should accept five objects I ran into a compiler error
"isBuildingModels" Cannot be accessed from outside package

make isBuildingModels public instead of package access to create custom TypedEpoxyController
@elihart
Copy link
Contributor

elihart commented Mar 12, 2018

I would prefer to make this protected instead of public.

In general though I would advise against Typed5EpoxyController. With that many params it seems much cleaner and safer to have a kotlin data class to represent your data state

@anasanasanas
Copy link
Contributor Author

anasanasanas commented Mar 13, 2018

thanks @elihart,
I made it protected
I understand the protected part
but if I have a list of 5 different items wouldn't be better to use Typed5EpoxyController?

@elihart elihart merged commit d1da6fb into airbnb:master Mar 13, 2018
@elihart
Copy link
Contributor

elihart commented Mar 13, 2018

@anasanasanas thanks for updating, merged.

The problem with that many params is the typed controller does not give helpful param names in setData, so all you see is setData(data1, data2, data3).

if you make a wrapper class in kotlin

class ControllerState(val thingName: MyThing ...)

typedEpoxyController.setData(ControllerState(thingName = ...)

you have a lot more visibility into what the data actually represents, you can add kdoc for the parameters, you can store the data altogether and use copy to modify it, etc

@anasanasanas
Copy link
Contributor Author

I get it now.
many thanks @elihart

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.

2 participants