Instagram / Instagram/IGListKit

IGListAdapter methods accepting & returning id/Any when they could be marked as IGListDiffable

Open
#1,007 3 comments 0 reactions 2 assignees Claimed by @jessesquires View on GitHub
question
Dominant language
Objective-C
Stars
13.1k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Apollogies in advanced if this is been asked previously, I looked in open and closed requests but couldn't find anything.

There are a number of methods on `IGListAdapter` (and other classes but im concerned with `IGListAdapter` at the moment) that could accept or return `id` values that are imported as `Any` in Swift. The following are

* `- (void)reloadObjects:(NSArray *)objects;`
* `- (__kindof IGListSectionController * _Nullable)sectionControllerForObject:(id)object;`
* `- (nullable id)objectForSectionController:(IGListSectionController *)sectionController;`
* `- (nullable id)objectAtSection:(NSInteger)section;`
* `- (NSInteger)sectionForObject:(id)object;`
* `- (NSArray *)objects;`
* `- (NSArray *)visibleObjects;`
* `- (NSArray *)visibleCellsForObject:(id)object;`
* `- (void)scrollToObject:(id)object ...`

It seems clear from their usage as described in the header that these are the same object retrieved from the datasource and that they would thus conform to `IGListDiffable`.

I was wondering if there was a technical reason for the omission of the type information since its presence would avoid unnecessary casts in Swift.

## New issue checklist

- [X] I have reviewed the [`README`](https://github.com/Instagram/IGListKit/blob/master/README.md) and [documentation](http://instagram.github.io/IGListKit)
- [X] I have searched [existing issues](https://github.com/Instagram/IGListKit/issues) and this is not a duplicate

### General information

- `IGListKit` version: 3.1.1
- iOS version(s): 11.1
- CocoaPods/Carthage version: 1.3.1
- Xcode version: 9.1
- Devices/Simulators affected: N/A
- Reproducible in the demo project? (Yes/No): N/A
- Related issues: None that I could find

### Debug information

```bash
# Please include debug logs using the following lldb command:
po [IGListDebugger dump]
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.