Following instructions from ChatGPT, I'm trying to rearrange the order of rows in a UITableView.
- (void)tableView:(UITableView *)tableView performDropWithCoordinator:(id<UITableViewDropCoordinator>)coordinator {
NSIndexPath *destinationIndexPath = coordinator.destinationIndexPath ?: [NSIndexPath indexPathForRow:self.items.count inSection:0];
[tableView performBatchUpdates:^{
for (UITableViewDropItem *dropItem in coordinator.items) {
NSString *movedItem = dropItem.dragItem.localObject;
if (movedItem) {
NSIndexPath *sourceIndexPath = dropItem.sourceIndexPath;
if (sourceIndexPath) {
[self.items removeObjectAtIndex:sourceIndexPath.row];
[self.items insertObject:movedItem atIndex:destinationIndexPath.row];
[tableView moveRowAtIndexPath:sourceIndexPath toIndexPath:destinationIndexPath];
}
}
}
} completion:nil];
}
Xcode is complaining that UITableViewDropItem does not exist.
The class is in all the documentation, it is just not showing up when needed!
Suggestions?