-
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
Support supplementaryViews created from nibs #90
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact [email protected] if you have any questions. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
- (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewOfKind:(NSString *)elementKind | ||
forSectionController:(IGListSectionController <IGListSectionType> *)sectionController | ||
nibName:(NSString *)nibName | ||
bundle:(NSBundle *)bundle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need this to be nullable: bundle:(nullable NSBundle *)bundle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right! just like the documentation i copied said :)
nibName:(NSString *)nibName | ||
bundle:(NSBundle *)bundle | ||
atIndex:(NSInteger)index { | ||
IGAssertMainThread(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also add:
IGParameterAssert([nibName length] > 0);
IGParameterAssert([elementKind length] > 0);
I realize those are also missing from other methods. Adding some starter tasks for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bundle
should be nullable
here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that, I'm trying this framework, hope to have this feature ASAP, without attention to details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rawlinxx no worries! PRs are an iterative process, its good to get something up and we can all work on it together 👨👩👧👦
atIndex:(NSInteger)index | ||
{ | ||
const NSUInteger offset = [self offsetForSectionController:sectionController]; | ||
return (UICollectionViewCell *_Nonnull)[self.collectionContext dequeueReusableSupplementaryViewOfKind:elementKind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this cast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not quite understand why (UICollectionViewCell *_Nonnull) is needed here, just following the previous method implementation since I have not read all the source code yet, i think UICollectionReusableView is more suitable here, am i wrong?
Also need to update the |
@rawlinxx updated the pull request - view changes |
@@ -759,6 +761,25 @@ - (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewOfKind:(N | |||
return [collectionView dequeueReusableSupplementaryViewOfKind:elementKind withReuseIdentifier:identifier forIndexPath:indexPath]; | |||
} | |||
|
|||
- (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewOfKind:(NSString *)elementKind | |||
forSectionController:(IGListSectionController <IGListSectionType> *)sectionController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's remove the space between IGListSectionController<IGListSectionType>
@note This method uses a string representation of the view class as the identifier. | ||
*/ | ||
- (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewOfKind:(NSString *)elementKind | ||
forSectionController:(IGListSectionController <IGListSectionType> *)sectionController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: spacing between class and protocol
forSectionController:self | ||
class:viewClass | ||
atIndex:(index + offset)]; | ||
} | ||
|
||
- (UICollectionReusableView *)dequeueReusableSupplementaryViewOfKind:(NSString *)elementKind | ||
forSectionController:(IGListSectionController <IGListSectionType> *)sectionController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spacing between class/protocol
forSectionController:self | ||
nibName:nibName | ||
bundle:bundle | ||
atIndex:(index + offset)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we realign the colons?
nibName:(NSString *)nibName | ||
bundle:(NSBundle *)bundle | ||
atIndex:(NSInteger)index | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curly needs to be on the same line as the last param
atIndex:(NSInteger)index | ||
{ | ||
const NSUInteger offset = [self offsetForSectionController:sectionController]; | ||
return (UICollectionReusableView *_Nonnull)[self.collectionContext dequeueReusableSupplementaryViewOfKind:elementKind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think UICollectionReusableView is more suitable here, am i wrong?
Hmm I'm actually not sure why we're casting it in the other methods. I just tried it locally and we can remove those. I wouldn't worry about it now. Can we revert the UICollectionReusableView
changes? We can do cleanup in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@rawlinxx updated the pull request - view changes |
# Conflicts: # Source/IGListAdapter.m
@rawlinxx updated the pull request - view changes |
Any update on this PR 🤔? |
Re-opening. @rawlinxx - was this closed by mistake? |
@rnystrom - If needed, we can push commits directly to this PR for tests and carry it forward. |
Summary: Continuing the work on #90. I don't believe I can push directly to that PR since the origin is `master` of a repo I don't have access to. https://help.github.com/articles/checking-out-pull-requests-locally/ I went ahead and added another supplementary view test copying the old one we had. cc jessesquires in case there's something else I can do here. I believe this will still give rawlinxx credit? Closes #162 Differential Revision: D4137364 Pulled By: rnystrom fbshipit-source-id: d8418ac5728fd6d9570fa1d1568f4343f5c4112b
Changes in this pull request
Summary: add dequeueReusableSupplementaryView with nib