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

Consider supplementary views when sending display events #470

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Source/Internal/IGListDisplayHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@interface IGListDisplayHandler ()

@property (nonatomic, strong) NSCountedSet *visibleListSections;
@property (nonatomic, strong) NSMapTable *visibleCellObjectMap;
@property (nonatomic, strong) NSMapTable *visibleViewObjectMap;

@end

Expand All @@ -26,15 +26,15 @@ @implementation IGListDisplayHandler
- (instancetype)init {
if (self = [super init]) {
_visibleListSections = [[NSCountedSet alloc] init];
_visibleCellObjectMap = [[NSMapTable alloc] initWithKeyOptions:NSMapTableStrongMemory valueOptions:NSMapTableStrongMemory capacity:0];
_visibleViewObjectMap = [[NSMapTable alloc] initWithKeyOptions:NSMapTableStrongMemory valueOptions:NSMapTableStrongMemory capacity:0];
}
return self;
}

- (id)pluckObjectForView:(UICollectionReusableView *)view {
NSMapTable *cellObjectMap = self.visibleCellObjectMap;
id object = [cellObjectMap objectForKey:view];
[cellObjectMap removeObjectForKey:view];
NSMapTable *viewObjectMap = self.visibleViewObjectMap;
id object = [viewObjectMap objectForKey:view];
[viewObjectMap removeObjectForKey:view];
return object;
}

Expand All @@ -48,7 +48,7 @@ - (void)willDisplayReusableView:(UICollectionReusableView *)view
IGParameterAssert(object != nil);
IGParameterAssert(indexPath != nil);

[self.visibleCellObjectMap setObject:object forKey:view];
[self.visibleViewObjectMap setObject:object forKey:view];
NSCountedSet *visibleListSections = self.visibleListSections;
if ([visibleListSections countForObject:sectionController] == 0) {
[sectionController.displayDelegate listAdapter:listAdapter willDisplaySectionController:sectionController];
Expand Down