---
title: NSCollectionLayoutGroup
framework: appkit
role: symbol
role_heading: Class
path: appkit/nscollectionlayoutgroup
---

# NSCollectionLayoutGroup

A container for a set of items that lays out the items along a path.

## Declaration

```swift
class NSCollectionLayoutGroup
```

## Overview

Overview Groups determine how the items in a collection view lay 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 doesn’t 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 NSCollectionLayoutDimension. Because a group is a subclass of NSCollectionLayoutItem, 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 (NSCollectionLayoutSection) of your collection view layout with that group.

## Topics

### Creating a horizontal group

- [horizontal(layoutSize:subitems:)](appkit/nscollectionlayoutgroup/horizontal(layoutsize:subitems:).md)
- [horizontal(layoutSize:subitem:count:)](appkit/nscollectionlayoutgroup/horizontal(layoutsize:subitem:count:).md)

### Creating a vertical group

- [vertical(layoutSize:subitems:)](appkit/nscollectionlayoutgroup/vertical(layoutsize:subitems:).md)
- [vertical(layoutSize:subitem:count:)](appkit/nscollectionlayoutgroup/vertical(layoutsize:subitem:count:).md)

### Creating a custom group

- [custom(layoutSize:itemProvider:)](appkit/nscollectionlayoutgroup/custom(layoutsize:itemprovider:).md)

### Getting the group’s items

- [subitems](appkit/nscollectionlayoutgroup/subitems.md)
- [supplementaryItems](appkit/nscollectionlayoutgroup/supplementaryitems.md)

### Configuring group spacing

- [interItemSpacing](appkit/nscollectionlayoutgroup/interitemspacing.md)

### Debugging group layout

- [visualDescription()](appkit/nscollectionlayoutgroup/visualdescription().md)

## Relationships

### Inherits From

- [NSCollectionLayoutItem](appkit/nscollectionlayoutitem.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Components

- [NSCollectionLayoutItem](appkit/nscollectionlayoutitem.md)
- [NSCollectionLayoutSection](appkit/nscollectionlayoutsection.md)
