-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
RFC: Add section property to IGListSectionController #609
Comments
Makes sense to me.
Yep. This is what we already do for I would say we definitely don't want this in |
Let's do this in 3.0 |
On board w/ this, ++ 3.0 @amonshiz you wanna take this on? |
Will do. Finally back from a pretty crazy week. Gonna start this week and should have PR pretty quickly. |
How would this handle updating the index of all section controllers, if I inserted a section at index 0? If it's a matter of convenience, then we should make the property |
^^ I assumed that's always what this was about, just a convenience wrapper |
The overall goal was to remove |
|
In a similar fashion to |
But if the object wasn't updated, then we wouldn't visit the section controller in that for loop. |
You could set the section index right up there where you set |
just to follow back up with this, i kind of melded both suggestions: move setting the |
IGListKit
should remove the-[IGListCollectionContext sectionForSectionController:]
method fromIGListCollectionContext
and replace it with asection
property onIGListSectionController
.Reasons
sectionForSectionController:
has nothing to do with the collection displaying the section/list. This method alone requires that theIGListAdapter
be thecollectionContext
object.IGListAdapter
knowing, and at that point it would be a new section controller anyhow.collectionContext
object to really be anything and not something that owns a mapping from section controller to an index.The reasons that this method was originally added are all solved by adding a
section
property and as mentioned, that property is known at creation time.Options
init
method ofIGListSectionController
@property (nonatomic, readwrite, assign) NSInteger index;
The
init
option is great because it means the property can bereadonly
, but it does mean that all subclasses have to be careful to include the property also.The
readwrite
property is nice because then theIGListKit
infra can own setting it. The downside is everyone knows that property can be written to. Maybe this is declared inIGListSectionController.h
asreadonly
and inIGListSectionControllerInternal.h
it is redeclared asreadwrite
?Context
Speaking with @rnystrom in person about ways to break up implicit dependencies on
UICollectionView
and this method stood out as one that could be culled and would easily break up a hidden dependency onIGListAdapter
.The text was updated successfully, but these errors were encountered: