LinkedInAttic / LayoutKit

LayoutKit is a fast view layout library for iOS, macOS, and tvOS.
http://layoutkit.org
Apache License 2.0
3.16k stars 267 forks source link

Clarity of viewReuseId #137

Open dgattey opened 7 years ago

dgattey commented 7 years ago

Currently, it's unclear from the docs what viewReuseId means. If it should be used to uniquely identify every single view, if it's useful in collection view cells, if it's useful for animation, etc. This issue serves as a bookmark to make this clearer in the documentation.

For those interested, viewReuseId should not uniquely identify each view. Rather, it should identify layouts that are the same across a few different views. If you have a collection view with cells that all have the same layouts but different content, each element of the cell should have a unique view reuse ID. Therefore, every cell will have the same view reuse IDs for its elements.

Additionally, view reuse IDs are useful for animations. It makes them faster because it can reuse the first layout's elements when animating to a second layout.

nicksnyder commented 7 years ago

More doc would be good. Similar to reuseIdentifier for UITableViewCell and UICollectionViewCell.