A container for a set of items that lays out the items along a path.
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
Groups determine how the items in a collection view are laid out in relation to each other. A group might lay out its items in a horizontal row, a vertical column, or a custom arrangement. A group determines the rules for how items are rendered in relation to each other, but in itself does not render any content.
For example, in the Photos app, a group of items is a row of photos. In the App Store app, a group might be a single column of cells (items) arranged in a vertical column.
Each group specifies its own size in terms of a width dimension and a height dimension. Groups can express their dimensions relative to their container, as an absolute value, or as an estimated value that might change at runtime, like in response to a change in system font size. For more information, see
Because a group is a subclass of
NSCollection, it behaves like an item. You can combine a group with other items and groups into more complex layouts.
After you configure a group, you must initialize a section (
NSCollection) of your collection view layout with that group.