Fix public compilation by making METAUIKitBridge conditional

Summary:
`IGListKit` was failing to compile in public/open source builds (SPM, CocoaPods) because it unconditionally imported an internal library `METAUIKitBridge` on macOS.

The issue:
- The header `#import <METAUIKitBridge/METAUIKitBridge.h>` would fail to resolve

The fix:
- Use `__has_include` to conditionally import METAUIKitBridge only when available
- Fall back to plain `Cocoa/Cocoa.h` for public builds

This preserves internal macOS functionality while allowing the open source version of `IGListKit` to compile without the Meta-internal dependency.

Differential Revision: D101185193

fbshipit-source-id: 40cd9d9ce1bc5ad7e78cf190ced111e179e3badb
This commit is contained in:
Cameron Roth 2026-04-16 12:51:41 -07:00 committed by meta-codesync[bot]
parent fc3443fb9f
commit 86f208f7a1
2 changed files with 5 additions and 1 deletions

View file

@ -7,6 +7,8 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag
### Fixes
- Fixed public compilation failure on macOS (SPM, CocoaPods) by conditionally importing METAUIKitBridge only when available. [Cameron Roth](https://github.com/camroth)
- An infinite recursion crash when VoiceOver is enabled and `scrollViewDelegate` or `collectionViewDelegate` is set to the adapter's own `UICollectionView`. [Cameron Roth](https://github.com/camroth) [(#1658)](https://github.com/Instagram/IGListKit/issues/1658)
5.2.0

View file

@ -9,8 +9,10 @@
#if TARGET_OS_EMBEDDED || TARGET_OS_SIMULATOR || TARGET_OS_MACCATALYST
#import <UIKit/UIKit.h>
#elif TARGET_OS_OSX
#else // TARGET_OS_OSX
#if __has_include(<METAUIKitBridge/METAUIKitBridge.h>)
#import <METAUIKitBridge/METAUIKitBridge.h>
#else
#import <Cocoa/Cocoa.h>
#endif
#endif