Inaccurate documentation for UICollectionViewCell

Originator:melissa.he.131
Number:rdar://FB8804144 Date Originated:10/15/2020
Status:Open Resolved:No
Product:iOS, Mac Catalyst, tvOS Product Version:iOS 6.0+ Mac Catalyst 13.0+ tvOS 9.0+
Classification:Incorrect/Unexpected Behavior Reproducible:Yes
 
Basic information
Please provide a descriptive title for your feedback:
Inaccurate documentation for UICollectionViewCell

Which area are you seeing an issue with?
Documentation

What type of feedback are you reporting?
Incorrect/Unexpected Behavior

Details
Please provide the URL of the content you reporting an issue with:
https://developer.apple.com/documentation/uikit/uicollectionreusableview/1620141-prepareforreuse?changes=_9&language=objc

Description

Please describe the issue:
The documentation says that the default implementation of the `prepareForReuse` method does nothing. However, the stack trace in the attached image shows that `-[UIView(Animation) _removeAllAnimations:]` was being called from `-[UICollectionViewCell prepareForReuse]`.
Please list the steps you took to reproduce the issue:
1. Created a collection view
2. Created a cell and overrode the layer class
3. Overrode the `removeAllAnimations` method on the layer class
4. Breakpoint in `removeAllAnimations`
5. Add `CABasicAnimation` with large repeat count to cell
6. Call `reloadData` on the collection view

What did you expect to happen?
I added some animation to the collection view cell. The documentation describes that the default implementation of `-[UICollectionViewCell prepareForReuse]` should do nothing, so I expected the animation in the collection view cell to persist after reloading was complete.

What actually happened?
The animation in the collection view cell abruptly stopped after the data was reloaded. It took a while to figure out the root cause since the documentation does not mention that any existing animations will stop after `-[UICollectionView reloadData]` or `-[UICollectionViewCell prepareForReuse]` are called.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!