Commit graph

933 commits

Author SHA1 Message Date
Cameron Roth
e3facbed27 Replace IGFailAssert with NSLog for delegate recursion checks
Summary:
The delegate recursion protection code (for GitHub issue #1658) uses IGFailAssert to warn about invalid delegate configurations. However, IGFailAssert is defined as NSCAssert which throws exceptions in debug/test builds, preventing the recovery code from executing.

This change replaces IGFailAssert with NSLog for these 4 specific cases
where the code is designed to gracefully recover:

1. When setting collectionView and _scrollViewDelegate points to it
2. When setting collectionView and _collectionViewDelegate points to it
3. When calling setCollectionViewDelegate: with the collectionView itself
4. When calling setScrollViewDelegate: with the collectionView itself

By using NSLog instead, the warning is still logged but execution continues, allowing the recovery code (clearing delegates or returning early) to run.
This fixes 23 test failures in IGListKitTests where tests were either:
- Intentionally testing the delegate protection behavior
- Inadvertently triggering the assertion when swapping adapters/collection views

Differential Revision: D101185192

fbshipit-source-id: 1f7cdc70b39f69364ce540d6b46bc8eb7ec22f9d
2026-04-16 16:42:39 -07:00
Cameron Roth
86f208f7a1 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
2026-04-16 12:51:41 -07:00
Cameron Roth
fc3443fb9f Fix VoiceOver infinite recursion crash when delegate set to collectionView (Issue 1658)
Summary:
https://github.com/Instagram/IGListKit/issues/1658

This fix addresses a crash that occurs when VoiceOver is enabled and `scrollViewDelegate` or `collectionViewDelegate` is set to the adapter's own `UICollectionView`.

## The Problem

When VoiceOver is enabled, accessibility queries trigger delegate method calls on the collection view. If the collection view is also set as its own scroll view delegate (via `IGListAdapter`'s proxy), these delegate calls get forwarded back to the collection view, creating infinite recursion:

1. VoiceOver queries accessibility on collectionView
2. `collectionView.delegate` (the proxy) forwards to `scrollViewTarget`
3. `scrollViewTarget` IS the collectionView → back to step 1
4. Stack overflow crash

Example crash-triggering code:
```
adapter.collectionView = collectionView
adapter.scrollViewDelegate = collectionView  // Crash with VoiceOver!
```

## The Fix

Here I've added validation in three places to prevent this configuration:

1. `setScrollViewDelegate:` - Rejects if `delegate == collectionView`
2. `setCollectionViewDelegate:` - Rejects if `delegate == collectionView`
3. `setCollectionView:` - Clears delegates if they equal the new collectionView

## Why This Is Safe (No Negative Side Effects)

**Setting UICollectionView as its own delegate provides no useful functionality:**
- `UICollectionView` already handles scroll events internally (it's a `UIScrollView` subclass)
- The `collectionView` doesn't implement custom `UIScrollViewDelegate` methods
- This configuration ONLY results in crashes when VoiceOver is enabled

**Behavior change is strictly beneficial:**
- Before: Works without VoiceOver, crashes WITH VoiceOver
- After: Silently rejects invalid config, works with VoiceOver

**Developer feedback is preserved:**
- `IGFailAssert` fires in `DEBUG` builds to alert developers to fix their code
- Production gracefully handles the situation instead of crashing

**No breaking changes for valid usage:**
- Normal delegate patterns (separate delegate objects) are unaffected
- Only the invalid self-referential pattern is blocked

See: https://github.com/Instagram/IGListKit/issues/1658

Reviewed By: dinhvh

Differential Revision: D100641752

fbshipit-source-id: a1885c4ede6ca0555f3f94dd0c72b328a5af62bc
2026-04-13 19:35:45 -07:00
Austin Du
01887c6e16 Migrate IGAPIValueObject to macOS
Summary: Add `sdks = (IOS, MACOSX)` to the IGAPIValueObject target to enable macOS builds. Also fix IGListDiffKit's IGListCompatibility.h to avoid importing full AppKit/Cocoa on macOS, which caused module definition conflicts with NSTextView. Instead, declare the needed NSIndexPath category methods directly.

Differential Revision: D93376344

fbshipit-source-id: b1d6c006b33969ab918921279da191d598052d33
2026-02-25 01:39:13 -08:00
Tim Oliver
3752371dac Refine Demo Apps for iOS 26 (#1655)
Summary:
## Changes in this pull request

I went through and improved some of the demo apps UI to look a bit cleaner on iOS 26.

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/instagram/IGListKit/pull/1655

Reviewed By: jurmarcus

Differential Revision: D93350298

Pulled By: TimOliver

fbshipit-source-id: 2a8c5ddbca313e9a5ccca7f8b06f04c6bc44649b
2026-02-16 23:57:23 -08:00
Tim Oliver
894c34db05 Updated the IGListKit docs to v5.2.0 (#1656)
Summary:
## Changes in this pull request

Updates the IGListKit docs to the latest API spec in v5.2.0

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/instagram/IGListKit/pull/1656

Reviewed By: jurmarcus

Differential Revision: D93350284

Pulled By: TimOliver

fbshipit-source-id: fa4276caae7309f3ef0fd78f5a0c4bcc05d9cb9f
2026-02-16 23:54:31 -08:00
Tim Oliver
062b2f9f70 Bring Test Coverage back to > 99% (#1654)
Summary:
## Changes in this pull request

It's been a few years since I did an audit of our test suite. The majority of changes to IGListKit since then were adding additional error checking and hardening, so this was relatively straightforward.

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/instagram/IGListKit/pull/1654

Reviewed By: jurmarcus

Differential Revision: D91551666

Pulled By: TimOliver

fbshipit-source-id: c89c7a45abebb44dbf50b252bfadc9a7c2928683
2026-01-27 21:10:09 -08:00
Tim Oliver
dcda4e75ee Replaced FBReportMustFix with IGFailAssert (#1653)
Summary:
## Changes in this pull request

`FBReportMustFix` isn't recognized by the public version of IGListKit. It is wrapped by `IGFailAssert` to abstract error tracking between the public and private versions, and so this change was causing the GitHub repo to stop compiling.

This diff makes the appropriate change and confirms the unit tests are passing again.

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/instagram/IGListKit/pull/1653

Test Plan:
Compiling again!

 {F1984942550}

Differential Revision: D91551520

Pulled By: TimOliver

fbshipit-source-id: bdc9f786092853252011c551ce6d214a01445c63
2026-01-27 09:44:57 -08:00
Minqi Ma
358fe894f2 Defensive check for NaN frame values in layout
Summary:
Add a defensive check in `IGListCollectionViewLayout` to prevent `NSInternalInconsistencyException` crashes caused by NaN frame values.

**Problem:**
When UIKit attempts to use these NaN frames, it throws `NSInternalInconsistencyException` because NaN comparisons always return false, breaking layout calculations.

**Solution:**
- Check for NaN values in the frame before setting it on `UICollectionViewLayoutAttributes`
- Log a warning via `FBReportWarning` for visibility and debugging
- Return `nil` (consistent with existing OOB check pattern) to prevent the crash

Reviewed By: dinhvh

Differential Revision: D91268614

fbshipit-source-id: 092d85c4b9ef9d5a84238ab4bc4b21a3d768a928
2026-01-23 12:14:38 -08:00
generatedunixname89002005287564
93829a2a07 Run 'facebook-bad-const-placement-check fbtidy' linter on fbobjc via arc cast
Reviewed By: Daij-Djan

Differential Revision: D90872770

fbshipit-source-id: 7a13ea11c9a8eeac4080e3af712dae51b58cfd86
2026-01-16 16:31:13 -08:00
Maxime Ollivier
7240131cea improve assert details in IGListAdapter+UICollectionView
Summary:
These asserts could be very helpful to debug tricky crashes, but they don't tell us enough about which object/section-controller are returning invalid data. The backtrace itself doesn't have the info.

Lets:
* Add object and section-controller class names, but don't include the entire object description (can be very long)
* Clean up how we print NSIndexPath without the memory address. This can make group-by a lot more useful.

## Examples

Before:
>  IGListAdapter returned NaN height = nan for item at indexPath <<NSIndexPath: 0x90c0bb66134b9c8a> {length = 2, path = 0 - 0}>

After:
> IGListAdapter returned NaN width = nan {indexPath: 0-0, object: IGFooViewerLoadingModel, sectionController:IGFooLoadingSectionController, dataSource: IGFooDataSource}

Before:
> Section controller nil for section 1

After:
> Section controller is nil {indexPath: 1-0, object: IGStoryFooViewModel, sectionController: nil, dataSource: IGFooDataSource}

Differential Revision: D90555737

fbshipit-source-id: 7a993ce667d894fa98d59f2258158bf78e3fa33f
2026-01-13 12:57:29 -08:00
Tim Oliver
5784f6db51 Enable unit test suite for tvOS (#1649)
Summary:
## Changes in this pull request

Following up on https://github.com/instagram/IGListKit/issues/1401! This PR pulls in koenpunt's PR for tvOS test support and updates it against the latest version of IGListKit.

A few changes:

* I disabled the unit tests that require storyboards/NIBs for tvOS since we only have iOS formatted assets. We can follow this up in a future PR if need be.
* Rewrote the Travis build command for GitHub Actions
* Went through and gated any UIKit APIs that aren't available on tvOS.
* A few unit tests were failing since UICollectionView on tvOS does have a few implicit behavioral differences. I gated these for now, but if anyone using IGListKit on tvOS actually encounters these errors, please open an issue so we can track it and adjust our test suite accordingly.

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/instagram/IGListKit/pull/1649

Reviewed By: jurmarcus

Differential Revision: D88921781

Pulled By: TimOliver

fbshipit-source-id: fb8b0becde96a504a88b651343049e51ec438b6c
2025-12-11 00:46:38 -08:00
Andrew Cuneo
7dddb0d4c8 Formalize that the IGListAdapterDelegateAnnouncer is main-thread affined
Summary:
Today, the IGListAdapterDelegateAnnouncer is different than most other announcers in IG/FB/etc in that it not thread safe to add and remove listeners.

However, this isn't really enforced, and has lead to people calling add / remove on background threads, which is creating crashes: https://fburl.com/logview/f1x4ytdl

A different way to deal with this problem is to make the IGListAdapterDelegateAnnouncer thread safe (eg D87806041), but the principle there seems to be that this class is only intended to be dealt with on the main threasd.

So, the fix here is to just make sure we call this on the thread and add asserts. using on_main here guarantees that we don't dispatch if we are already on the main thread, so it should be safe to add.

Reviewed By: manicakes

Differential Revision: D88427711

fbshipit-source-id: 41f352495e0238618e4d6efe938bdaed370bb139
2025-12-05 09:55:47 -08:00
Tim Oliver
1cfe0ab4b7 Revert the header import changes (#1647)
Summary:
Another code automation changed the import stylings in some of the IGListKit headers. We've since updated the automation to skip IGListKit in future, so we just need to revert this commit and we should be good to go again!

Pull Request resolved: https://github.com/instagram/IGListKit/pull/1647

Test Plan: As long as the tests pass both internally and externally.

Reviewed By: jurmarcus

Differential Revision: D87851377

Pulled By: TimOliver

fbshipit-source-id: e6f1f98684457be41d9a7e197fb44dc8077bc8f0
2025-11-25 01:01:00 -08:00
generatedunixname89002005287564
7ea03a0cf2 fbsource//fbobjc/:30
Reviewed By: rmaz

Differential Revision: D87420822

fbshipit-source-id: 4d9b44b477268c08f764f40b94c995774274e2e1
2025-11-19 09:42:43 -08:00
Hoa Dinh
d1ddab8e20 Fix EXC_BAD_ACCESS crash in IGListSectionMap.m during IGListAdapter deallocation
Summary:
## Initial Devmate Prompt:
[https://www.internalfb.com/logview/basel\_ios\_crashes/cdf37c300a6041eebafd4aa2c2ed9846](https://www.internalfb.com/logview/basel_ios_crashes/cdf37c300a6041eebafd4aa2c2ed9846)

What's the issue that's causing this FAD?

Can you create a fix for it?
 ---
## LLM-generated Summary:
The changes fix a crash in IGListSectionMap.m that occurs during IGListAdapter deallocation. The issue is caused by accessing a nil or invalid sectionController, which is resolved by adding a nil check before invoking the block. This fix prevents the crash when section controllers are no longer available in the map during cleanup, ensuring a safe and defensive programming approach to handle the race condition during deallocation.
 ---
Session: DEV17393008

Differential Revision: D87261228

fbshipit-source-id: 8c147909b3090d8cf2914da1957bcd5d5b8b2cb4
2025-11-17 13:59:51 -08:00
Tim Oliver
98bd6c6a74 Fix the SPM build errors caused by removal of unprefixed headers (#1644)
Summary:
It looks like D86316341 caused the GitHub unit tests to stop passing since SPM relies on IGListKit and IGListDiffKit being in the same directory so there are no module imports.

This diff adds the same `__has_include` conditional checking so our internal and external module configurations will both work.

Pull Request resolved: https://github.com/instagram/IGListKit/pull/1644

Test Plan:
The external tests are working again. As long as the internal tests also pass, we should be good!

 {F1983488354}

Reviewed By: m3rlin45

Differential Revision: D86943807

Pulled By: TimOliver

fbshipit-source-id: c741acbb1f8425e92834daec720d4be3b3c264da
2025-11-17 00:08:32 -08:00
Kaur Ishnoor
0a0b11bdc8 Fix for MID barcelona_ios_fads/c3fbd3e0c8fe65d943ca7fbe1f493880
Differential Revision: D86603481

fbshipit-source-id: 07adbda059d500a1fc41e0b7182738eeb10818c9
2025-11-10 09:54:17 -08:00
Richard Howell
c38d8f337a use prefixed imports in exported_headers
Summary: Replace unprefixed includes in exported_headers with their prefixed equivalents. This avoids filesystem walking to find headers and makes it possible to resolve the headers via header maps.

Reviewed By: d16r

Differential Revision: D86316341

fbshipit-source-id: c3f5d4c5a8911cec45ccac2acd5ea466c244055e
2025-11-06 14:47:56 -08:00
Tim Oliver
bb6dea7d6d Bump IGListKit to v5.1.0
Summary: Updates the CHANGELOG with all of the latest enhancements and fixes, and bumps the version number of IGListKit to 5.1.0

Reviewed By: benhgreen

Differential Revision: D85926201

fbshipit-source-id: c3c37bbfb859da3ef753b3a8074cf28c8b0febfa
2025-10-30 23:19:01 -07:00
Jerome B
23daf6de72 Provided support for iOS 13 Context Menus (#1430)
Summary:
## Changes in this pull request

Issue fixed: Provided support for Context Menus

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1430

Test Plan: https://pxl.cl/2F940

Reviewed By: benhgreen

Differential Revision: D45309023

Pulled By: TimOliver

fbshipit-source-id: 9f3d7871288437414ae3c0d2941802aa506a5553
2025-10-30 21:58:06 -07:00
Tim Oliver
c7de5ef11b Remove iOS 26.0 reference from the GitHub Actions manifest (#1643)
Summary:
I noticed that in the latest commit to main, [the build had started failing](https://github.com/Instagram/IGListKit/actions/runs/18856759807/job/53806413365).

Looking into it, it seems GitHub has removed `iOS 26.0` as a valid destination, replacing it with both `iOS 26.0.1` and `iOS 26.1` on their `macos-26` runner target.

I tried removing the explicit iOS version define in the CI YAML file, but unfortunately, this ended up breaking the UI test target. It turns out that one requires the 'preboot' step in order to work, and without an OS number, the preboot, and xcodebuild steps both arbitrarily choose different simulator slices to execute. :(

On top of that, when I fixed this issue and tried to do a fresh build, `IGSectionMap` was throwing a build error in one of the IGAsserts, requiring that the provided `NSUInteger` needed to be typecast to `(unsigned int)`.

So, in order to fix this moving forward, I went back to macos-14, since we're pretty safe in that iOS 18's build numbers probably won't be updated in that one for a fair while.

Pull Request resolved: https://github.com/instagram/IGListKit/pull/1643

Test Plan: I confirmed the external tests pass, so as long as the internal ones pass too, we should be good!

Reviewed By: m3rlin45

Differential Revision: D85658369

Pulled By: TimOliver

fbshipit-source-id: 78cc0f9d9e9e095bb99c010d844d2186be0017f6
2025-10-28 21:45:43 -07:00
Maxime Ollivier
64ba471201 assert when diffIdentifier changes between updates
Summary:
`diffIdentifier` should not have changed before an update starts, otherwise we can't look up the corresponding section-controller.

Lets add an assert when we detect this issue. In a few months, we should evaluate if this is still useful.

Differential Revision: D85456085

fbshipit-source-id: 9aee649477618e2fdcd5b8e972d8eae0719bed85
2025-10-27 14:38:36 -07:00
Maxime Ollivier
f2fb62a394 add types to IGListSectionMap
Summary: Objects in `IGListSectionMap` should be `id<IGListDiffable>`. This is gonna make the next diff easier too. We probably should do the same with `IGListAdapter`, but that requires a bigger refactor for another time.

Differential Revision: D85372926

fbshipit-source-id: 0b9828ce28bd7906a6abf13d6bb3cc2a9fbb2e9c
2025-10-27 14:38:36 -07:00
Tim Oliver
e7ea4ae174 Add Meta copyright to IGListPerformDiff.m
Summary: One of the implementation files in IGListKit didn't have the appropriate copyright headers, which was causing one of the open source health checks to throw a warning.

Reviewed By: DimaVartanian

Differential Revision: D83947233

fbshipit-source-id: c5ce059373a57b4b235810f42e21bb4ab5181051
2025-10-06 17:22:13 -07:00
Tim Oliver
e5bc6bcae6 Remove using CocoaPods to build IGListKit's test suite (#1641)
Summary:
## Changes in this pull request

[As was announced in late 2024](https://blog.cocoapods.org/CocoaPods-Specs-Repo/), CocoaPods will be eventually sunset with the tentative end date being at the end of 2026.

While we had already migrated all of IGListKit's sample apps to use SPM, the main Xcode project was still relying on CocoaPods to import OCMock as a dependency of running its test suite.

In order to get ahead of this eventual shut down, this PR completely removes CocoaPods as a dependency of running any of the projects in this repo and moves OCMock over to an SPM import. This ends up actually being a better experience since now, all anyone needs to do is open `IGListKit.xcodeproj` without needing to run anything beforehand, and Xcode will automatically handle the rest.

Please note this doesn't remove IGListKit from CocoaPods itself. IGListKit will still be available as a CocoaPods dependency.

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [ ] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/instagram/IGListKit/pull/1641

Test Plan:
All GitHub pipelines still working:

 {F1982500959}

Reviewed By: fabiomassimo

Differential Revision: D83946914

Pulled By: TimOliver

fbshipit-source-id: 3542451379b57c87c88fc95684fb3595a09c8fd6
2025-10-06 08:21:43 -07:00
Constantine Fry
700905e628 Disable cache invaldation when the collection view perform an insertion of a new page to the list
Summary: See https://docs.google.com/document/d/1DRB_ZUZU15Cm0968zc7N8WmhUF4aFBhnk-GiR4ssVFQ/edit?tab=t.0

Reviewed By: matrush

Differential Revision: D81792852

fbshipit-source-id: c56f652b22d6adea21629f7c950f174892a59b5e
2025-09-08 02:47:19 -07:00
Yury Dymov
0944f8e809 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
2025-09-04 08:24:17 -07:00
Maxime Ollivier
fec6b0ef0f add autoDeselectEnabled to IGListAdapter
Summary: We're finding ourselves with the need to delesect a lot of cells, but still allow selction. We could do it in each section-controller, but it's easy to mess up and forget in new section-controllers. So, lets add "auto deselection" to `IGListAdapter` directly. When enabled, section-controllers still get the `-didSelect`, but they don't need to deselect the cell.

Differential Revision: D80272474

fbshipit-source-id: 3d905f1f37def6af3cbc6f4d35e256826b7555fb
2025-08-15 07:56:14 -07:00
Abhyas Mall
01bd505d8b Feed View Controller Demo and Improve UI Testing Infrastructure (#1629)
Summary:
## Changes in this pull request

This PR adds a new feed view controller demo to the IGListKit example app, showcasing how to implement a social media feed with IGListKit. The demo features infinite scrolling with pagination, post deletion, and interactive elements. Also, I've improved the UI testing infrastructure by adding helper methods for more reliable tests across different device types. The new helpers make the tests more resilient when dealing with iPad split views and ensure elements are properly visible before interacting with them.

### Checklist

- [X] All tests pass. Demo project builds and runs.
- [X] I added tests, an experiment, or detailed why my change isn't tested.
- [X] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1629

Reviewed By: fabiomassimo

Differential Revision: D77482204

Pulled By: TimOliver

fbshipit-source-id: 44ac86ed253e8452388aad50a1ed05bc6f3a31ab
2025-06-28 10:28:37 -07:00
Alex Oakley
101665de09 Adding missing NS_UNAVAILABLE NSCoder constructor declaration to IGListKit
Summary:
### Context

This stack implements base `UIKit` types in Objective-C by removing the requirement to provide `NSCoder` based constructor in Swift.

### This diff

`IGListKit` seems to have `NSCoder` constructors marked unavailable except for the single type `IGListCollectionViewLayout`. So adding it there.

### Project context / references

[Opti project](https://fburl.com/gdoc/7hekhwd5)
[META UIKit RFC](https://fburl.com/gdoc/9maag852)

Reviewed By: TimOliver

Differential Revision: D77116862

fbshipit-source-id: 9ae48258131a439b1e8ae84ac23ff5ea14b87281
2025-06-24 19:38:02 -07:00
Amit Kumar
a37a0ca1b7 Enable Swift 6 on IGAvatarUnlockableQuestsUI
Summary: ^

Differential Revision: D76170610

fbshipit-source-id: 9d464eff0c215f98622fa1f1d44e3cc38c77f048
2025-06-07 13:41:35 -07:00
Nolan O'Brien
8aff5ce1a3 Handle unexpected (out-of-range) cases in switch statements for CompilerWarningLevel.HIGH targets
Summary: For `CompilerWarningLevel.HIGH` targets (except Instagram), let's address `switch` without `default` present

Reviewed By: aary

Differential Revision: D75460752

fbshipit-source-id: dd0a4594421580b745b7bb866efe4a86d3061d6d
2025-05-28 09:28:35 -07:00
Amit Kumar
6451aee059 Enabled Swift 6 on IGFitnessStickersUI
Summary: Many protocols that are conformed only by VCs needed to be marked main actor.

Reviewed By: ebgraham

Differential Revision: D74761535

fbshipit-source-id: b5d047b625df5cf16759aa5c19e5bf57594a3d99
2025-05-15 10:51:05 -07:00
Maxime Ollivier
9106963a39 add experimental fix for preferredFocusedView
Summary: The default implementation of `-[UICollectionView preferredFocusedView]` can create/dequeue off-screen cells, which causes perf issues and bugs. Lets create `IGListExperimentFixPreferredFocusedView` to return a visbile index-path.

Differential Revision: D74484148

fbshipit-source-id: f710be56b938f8474278cf88b7e2e4268f702f1d
2025-05-09 12:09:43 -07:00
Maria Roodnitsky
59255166b2 Fix 'veiw' mispelling
Summary:
Easy little diffs to correct the spelling heathens of the past. O:)

As titled.

Differential Revision: D73490845

fbshipit-source-id: f8868eb5a1ebaac771e73d832baa1245a9cd2c5a
2025-04-28 21:05:48 -07:00
Jesse Seidman
af780c01ef Update changelog for IGListAdapterDelegate methods
Summary: Updates Changelog for the breaking IGListAdapterDelegate changes

Differential Revision: D73666488

fbshipit-source-id: 5afab545d955df9ad7955d73bb54a94c3e1ccdaf
2025-04-25 08:20:22 -07:00
Jesse Seidman
03049f742f Add IGListAdapterDelegate Methods 3/n
Summary:
## CONTEXT
`IGListAdapterDelegate` currently has methods that are fired when an object is *first* displayed and when an object *ended* display on screen.  For many use cases this works but there are use cases in which it would be helpful to know whenever a cell will be displayed or ends display.  This is especially relevant in the `IGListAdapterDelegateAnnouncer` which will enable you to add code for tracking cells globally.  This change also balances the `IGListAdapterDelegate` with `IGListDisplayDelegate`  which has methods which include the cell as well

## PLAN
This diff will be go out in multiple parts
- delegate method addition (many file change due to our pattern of not preferring default implementation of protocol methods)
- Update to `IGListDisplayHandler` and `IGListAdapterDelegateAnnouncer` for invocation of delegate methods
- Unit test additions

## THIS DIFF
This diff updates the unit tests of `IGListAdapterDelegateAnnouncerTests`, `IGListAdapterE2ETests` and `IGListDisplayHandlerTests`.  We added new expectations and to existing unit tests because the functionality to confirm is already tested it was just only checking the existing delegate methods.  The new tests check the new methods as well

Reviewed By: maxolls

Differential Revision: D70406065

fbshipit-source-id: ee054a21f0709b14081fdff38e22ab9710222794
2025-04-24 13:07:16 -07:00
Jesse Seidman
d1d6f9d52c Add IGListAdapterDelegate Methods 2/n
Summary:
## CONTEXT
`IGListAdapterDelegate` currently has methods that are fired when an object is *first* displayed and when an object *ended* display on screen.  For many use cases this works but there are use cases in which it would be helpful to know whenever a cell will be displayed or ends display.  This is especially relevant in the `IGListAdapterDelegateAnnouncer` which will enable you to add code for tracking cells globally.  This change also balances the `IGListAdapterDelegate` with `IGListDisplayDelegate`  which has methods which include the cell as well

## PLAN
This diff will be go out in multiple parts
- delegate method addition (many file change due to our pattern of not preferring default implementation of protocol methods)
- Update to `IGListDisplayHandler` and `IGListAdapterDelegateAnnouncer` for invocation of delegate methods
- Unit test additions

## THIS DIFF
This diff changes adds the invocation of `IGListAdapterDelegate` in `IGListDisplayHandler` and `IGListAdapterDelegateAnnouncer`.  The cell lifecycle method will be called every time. cell will display and did end display as opposed to the existing methods which are only called the *first* and *last* time an object is displayed

Differential Revision: D70348078

fbshipit-source-id: 820cd22af217f01f2d4916a70e203d9afc4c6a6d
2025-04-24 13:07:16 -07:00
Jesse Seidman
fa50aa1cf1 Add IGListAdapterDelegate Methods 1/n
Summary:
## CONTEXT
`IGListAdapterDelegate` currently has methods that are fired when an object is *first* displayed and when an object *ended* display on screen.  For many use cases this works but there are use cases in which it would be helpful to know whenever a cell will be displayed or ends display.  This is especially relevant in the `IGListAdapterDelegateAnnouncer` which will enable you to add code for tracking cells globally.  This change also balances the `IGListAdapterDelegate` with `IGListDisplayDelegate`  which has methods which include the cell as well

## PLAN
This diff will be go out in multiple parts
- delegate method addition (many file change due to our pattern of not preferring default implementation of protocol methods)
- Update to `IGListDisplayHandler` and `IGListAdapterDelegateAnnouncer` for invocation of delegate methods
- Unit test additions

## THIS DIFF
This diff changes the delegate to include the methods that pass in the cell.  This is a huge many file diff because we prefer to not include default implementations of protocol methods.  This makes the delegate change a breaking change.

Reviewed By: maxolls

Differential Revision: D70348102

fbshipit-source-id: 40709ba8a9112d8855d5ce5ecfd5930b5c79bf26
2025-04-24 13:07:16 -07:00
Nolan O'Brien
d0d38c4a33 Fix up warnings to get Instagram code onto CompilerWarningLevel.HIGH
Summary:
many fixes for making IG `.HIGH` in warning level

https://fb.workplace.com/groups/iOSDevQA/posts/28237779439177303

Differential Revision: D72878674

fbshipit-source-id: 9f53bc19aa534c1c2252446faf06ef2c8dc20612
2025-04-14 15:23:41 -07:00
Nolan O'Brien
431ae719dc Fix up places to get Instagram hierarchy of code onto CompilerWarningLevel.HIGH
Summary:
many fixes for making IG `.HIGH` in warning level

https://fb.workplace.com/groups/iOSDevQA/posts/28237779439177303

Differential Revision: D72679686

fbshipit-source-id: 592b61515ca1480a0b37ebd35c88786f9e1b3469
2025-04-11 12:19:53 -07:00
Krys Jurgowski
15b45d0d80 Example using SwiftUI with compositional layout
Summary: Introduces a compositional layout example that leverages section controller methods to determine layout.

Differential Revision: D71402637

fbshipit-source-id: 1179abf13157fb5cb78c8a9086718d1216fb4276
2025-03-19 10:14:23 -07:00
Tim Oliver
7e6a493dca General fixes to restore GitHub CI (#1622)
Summary:
The GitHub CI seems to be failing still since we added some new header files and didn't include the necessary ones in the IGListKit.h umbrella header.

This PR:

* Updates the umbrella header to include the new header files
* Updates the visibility of the private headers so they don't need to be included in the umbrella.
* Does a general clean-up of the Xcode project, re-ordering all of the newly imported files.

Assuming this all passes the external CI, we can land it in Phabricator.

Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1622

Test Plan: GitHub CI has passed: https://github.com/Instagram/IGListKit/actions/runs/13851019458

Reviewed By: fabiomassimo

Differential Revision: D71178515

Pulled By: TimOliver

fbshipit-source-id: 1ea643a7bc7a401c45af2776c2a66e3b806035d7
2025-03-14 23:56:06 -07:00
Hoa Dinh
0534ee22c4 _finishWithoutUpdate is not used
Summary: deletedelete

Reviewed By: dstnbrkr

Differential Revision: D71137052

fbshipit-source-id: 38e4998bc69a9f88fdff27d2b46895a211292892
2025-03-13 13:08:41 -07:00
Krys Jurgowski
cbb323f3cc Fix package file for IGListKit
Summary:
IGListKit via SPM does not currently compile due to `IGListAdapter+Async` (introduced in D64881920) which uses iOS 13+ APIs.
The simplest fix is to make IGListKit compatible with iOS 13+.

I haven't updated IGListKit before so not sure if there is some other process to follow with making an open source change?

Differential Revision:
D71118411

Privacy Context Container: L1132866

fbshipit-source-id: 74d85a9a0c60f05f941751b83b3080b2662fddc1
2025-03-13 11:13:31 -07:00
bartoszpawelczyk
24eee66aed Fix missing project and SPM references (#1621)
Summary:
## Changes in this pull request

Issue fixed: [1620](https://github.com/Instagram/IGListKit/issues/1620)

### Checklist

- [ ] All tests pass. Demo project builds and runs.
- [ ] I added tests, an experiment, or detailed why my change isn't tested.
- [ ] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [ ] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1621

Test Plan:
Tested that IG builds with these changes without issue. All seems good.
As

Reviewed By: NSProgrammer

Differential Revision: D70959852

Pulled By: TimOliver

fbshipit-source-id: 087411463ad1b7c0698d7aba543d85c9013abf39
2025-03-11 09:13:03 -07:00
Nolan O'Brien
e3523b36a4 Add indexesOfVisibleObjects
Summary:
It's inefficient to get the unordered array of visibleObjects to then try to find the order of those objects after.  Instead, introduce a new `indexesOfVisibleObjects` API to `IGListAdapter` which will inherently preserve order.

Will use this to help find the previous and next "item" to scroll to with Main Feed.

Differential Revision: D70835725

fbshipit-source-id: a5f66681e0184299d92f220be194b5554639a7da
2025-03-09 16:08:54 -07:00
Maxime Ollivier
9c0ef52715 add associatedListAdapters to UIViewController
Summary: We'd like to know which `IGListAdapter` is associated with a `UIViewController`, so lets keep track of that.  Every adapter should have only 1 controller and it can't change.

Differential Revision: D70631091

fbshipit-source-id: 7f818d7e8f1858a4c80e223be6d5aad5cfc639cf
2025-03-05 13:42:36 -08:00
Hoa Dinh
c93d0675d9 T202656292: Error: NSInternalInconsistencyException at UIKit/UIKitCore:-[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttribut - more debug info
Summary: Adding more debug info to figure out what's happening in sundial.

Differential Revision: D70545124

fbshipit-source-id: f0ce51529a712328941b9f9b08b70894388bdb14
2025-03-04 14:27:03 -08:00