Skip to content

Commit 0944f8e

Browse files
Yury Dymovfacebook-github-bot
authored andcommitted
UICollectionViewLayout+InteractiveReordering
Summary: ## Stack We aim to remove +load methods from the codebase to reduce pre-main startup time and to unblock enabling startup optimizations ## Diff UICollectionViewLayout+InteractiveReordering marked as Internal in IGListKit. I am assuming that this is an internal implementation detail of the IGListKit and is not supposed to run globally outside of the IGListKit context. Based on that assumption I migrated global +load API to a `setup` method, which is being execution in IGListAdapter constructor, core class of the IGListKit library Reviewed By: AfrazCodes Differential Revision: D81592721 fbshipit-source-id: 718b936e669669c66ec5b6c80fefc4bd106170c2
1 parent fec6b0e commit 0944f8e

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

Source/IGListKit/IGListAdapter.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ - (instancetype)initWithUpdater:(id <IGListUpdatingDelegate>)updater
5252
IGParameterAssert(updater);
5353

5454
if (self = [super init]) {
55+
[UICollectionViewLayout setupInteractiveReordering];
5556
NSPointerFunctions *keyFunctions = [updater objectLookupPointerFunctions];
5657
NSPointerFunctions *valueFunctions = [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory];
5758
NSMapTable *table = [[NSMapTable alloc] initWithKeyPointerFunctions:keyFunctions valuePointerFunctions:valueFunctions capacity:0];

Source/IGListKit/Internal/UICollectionViewLayout+InteractiveReordering.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ NS_ASSUME_NONNULL_BEGIN
1313

1414
@interface UICollectionViewLayout (InteractiveReordering)
1515

16+
// Should be called once to swizzle native APIs
17+
+ (void)setupInteractiveReordering;
18+
1619
- (void)ig_hijackLayoutInteractiveReorderingMethodForAdapter:(IGListAdapter *)adapter;
1720

1821
- (nullable NSIndexPath *)updatedTargetForInteractivelyMovingItem:(NSIndexPath *)previousIndexPath

Source/IGListKit/Internal/UICollectionViewLayout+InteractiveReordering.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ @implementation UICollectionViewLayout (InteractiveReordering)
1616

1717
static void * kIGListAdapterKey = &kIGListAdapterKey;
1818

19-
+ (void)load
19+
+ (void)setupInteractiveReordering
2020
{
2121
static dispatch_once_t onceToken;
2222
dispatch_once(&onceToken, ^{

0 commit comments

Comments
 (0)