Files
flipper/iOS/Plugins/FlipperKitPluginUtils/FlipperKitLayoutHelpers/FlipperKitLayoutHelpers/UICollectionView+SKInvalidation.mm
Kyle Cui 7c44d4d4f0 add macOS deps to shared libraries
Summary: Add macOS dependencies and alternative classes to the libraries that FlipperKitLayoutPlugin needs to function.

Reviewed By: priteshrnandgaonkar

Differential Revision: D27328277

fbshipit-source-id: f22d1e9f6a5415cee0bae8eaada653be5f5467b3
2021-03-29 16:13:24 -07:00

42 lines
984 B
Plaintext

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#if TARGET_OS_IPHONE
#if FB_SONARKIT_ENABLED
#import "UICollectionView+SKInvalidation.h"
#import "SKInvalidation.h"
#import "SKSwizzle.h"
FB_LINKABLE(UICollectionView_SKInvalidation)
@implementation UICollectionView (SKInvalidation)
+ (void)enableInvalidations {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
swizzleMethods(
[self class],
@selector(cellForItemAtIndexPath:),
@selector(swizzle_cellForItemAtIndexPath:));
});
}
- (UICollectionViewCell*)swizzle_cellForItemAtIndexPath:
(NSIndexPath*)indexPath {
dispatch_async(dispatch_get_main_queue(), ^{
[[SKInvalidation sharedInstance].delegate invalidateNode:self];
});
return [self swizzle_cellForItemAtIndexPath:indexPath];
}
@end
#endif // FB_SONARKIT_ENABLED
#endif