minimumInteritemSpacing on IGListGridCollectionViewLayout dosent work properly, if the section width is equal to collectionview width (full width), and the minimumInteritemSpacing is > 0, it crashes.
an example layout can be like Instagram explore page, the video section is full width, and the grid has minimumInteritemSpacing = 1
cc @zhubofei
@MarvinNazari This is weird, I just wrote a test for full-width items with non-zero interitem spacing set up and it works. Could you check if your item width exceeds the collectionView width first()? If the problem still exists, would you mind posting a sample project so that I can dig into it?
And we should definitely add a check in here. If item width exceeds collectionView width we should throw an error. 馃
@zhubofei ah found the crash, it happens when performing an update, so look at my latest commit at the sample code, and press "Add more" on navbar.
2016-12-23 00:41:36.602 IGListKitIssue[49325:3478853] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 3 beyond bounds [0 .. 2]'
*** First throw call stack:
(
0 CoreFoundation 0x000000011287dd4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000011012921e objc_exception_throw + 48
2 CoreFoundation 0x00000001127af2eb -[__NSArrayM objectAtIndex:] + 203
3 IGListKit 0x000000010fb869a4 -[_IGListGridLayoutLine attributesForItemAtIndexPath:withXOffset:] + 196
4 IGListKit 0x000000010fb86494 -[_IGListGridLayoutLine attributesForItemAtIndexPath:] + 820
5 IGListKit 0x000000010fb84224 -[IGListGridCollectionViewLayout layoutAttributesForItemAtIndexPath:] + 388
6 UIKit 0x0000000110f9cfa7 -[UICollectionViewData layoutAttributesForItemAtIndexPath:] + 341
7 UIKit 0x0000000110f9d160 -[UICollectionViewData layoutAttributesForGlobalItemIndex:] + 57
8 UIKit 0x0000000110f53206 -[UICollectionView _viewAnimationsForCurrentUpdate] + 6084
9 UIKit 0x0000000110f58899 __71-[UICollectionView _updateWithItems:tentativelyForReordering:animator:]_block_invoke.1993 + 197
10 UIKit 0x00000001106b2239 +[UIView(Animation) performWithoutAnimation:] + 90
11 UIKit 0x0000000110f573ef -[UICollectionView _updateWithItems:tentativelyForReordering:animator:] + 3942
12 UIKit 0x0000000110f51421 -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:] + 17765
13 UIKit 0x0000000110f59e72 -[UICollectionView _endUpdatesWithInvalidationContext:tentativelyForReordering:animator:] + 71
14 UIKit 0x0000000110f5a1b4 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:animator:] + 432
15 UIKit 0x0000000110f59fe1 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:] + 91
16 UIKit 0x0000000110f59f63 -[UICollectionView _performBatchUpdates:completion:invalidationContext:] + 74
17 UIKit 0x0000000110f59eb8 -[UICollectionView performBatchUpdates:completion:] + 53
18 IGListKit 0x000000010fb6919c -[IGListAdapterUpdater performBatchUpdatesWithCollectionView:] + 2956
19 IGListKit 0x000000010fb6bf15 __54-[IGListAdapterUpdater queueUpdateWithCollectionView:]_block_invoke + 357
20 libdispatch.dylib 0x00000001134a5978 _dispatch_call_block_and_release + 12
21 libdispatch.dylib 0x00000001134cf0cd _dispatch_client_callout + 8
22 libdispatch.dylib 0x00000001134af8a4 _dispatch_main_queue_callback_4CF + 406
23 CoreFoundation 0x0000000112841e49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
24 CoreFoundation 0x000000011280737d __CFRunLoopRun + 2205
25 CoreFoundation 0x0000000112806884 CFRunLoopRunSpecific + 420
26 GraphicsServices 0x00000001146f5a6f GSEventRunModal + 161
27 UIKit 0x00000001105f8c68 UIApplicationMain + 159
28 IGListKitIssue 0x000000010fa9bc2f main + 111
29 libdyld.dylib 0x000000011351b68d start + 1
30 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
@MarvinNazari I think I just caught the :bug:. I will post a PR tomorrow.
@zhubofei just tested #361, and works pefectly! 鉂わ笍
Most helpful comment
@MarvinNazari I think I just caught the :bug:. I will post a PR tomorrow.