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

Remove nibName argument from IGListReusableViewIdentifier #1223

Closed
zhubofei opened this issue Jul 23, 2018 · 2 comments
Closed

Remove nibName argument from IGListReusableViewIdentifier #1223

zhubofei opened this issue Jul 23, 2018 · 2 comments

Comments

@zhubofei
Copy link

/// Generate a string representation of a reusable view class when registering with a UICollectionView.
NS_INLINE NSString *IGListReusableViewIdentifier(Class viewClass, NSString * _Nullable nibName, NSString * _Nullable kind, NSString * _Nullable givenReuseIdentifier) {
return [NSString stringWithFormat:@"%@%@%@%@", kind ?: @"", nibName ?: @"", givenReuseIdentifier ?: @"", NSStringFromClass(viewClass)];
}

nibName was never used and should not be used to generate identifiers.

@rnystrom
Copy link
Contributor

Wait is that correct? Shouldn’t it have been used?

Sent with GitHawk

@zhubofei
Copy link
Author

@rnystrom

- (UICollectionViewCell *)dequeueReusableCellWithNibName:(NSString *)nibName
bundle:(NSBundle *)bundle
forSectionController:(IGListSectionController *)sectionController
atIndex:(NSInteger)index {
IGAssertMainThread();
IGParameterAssert([nibName length] > 0);
IGParameterAssert(sectionController != nil);
IGParameterAssert(index >= 0);
UICollectionView *collectionView = self.collectionView;
IGAssert(collectionView != nil, @"Dequeueing cell with nib name %@ and bundle %@ from section controller %@ without a collection view at index %li.", nibName, bundle, sectionController, (long)index);
NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:NO];
if (![self.registeredNibNames containsObject:nibName]) {
[self.registeredNibNames addObject:nibName];
UINib *nib = [UINib nibWithNibName:nibName bundle:bundle];
[collectionView registerNib:nib forCellWithReuseIdentifier:nibName];
}
return [collectionView dequeueReusableCellWithReuseIdentifier:nibName forIndexPath:indexPath];
}

Right now, nibNames are used as identifiers directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants