---
title: NSCollectionViewCompositionalLayoutConfiguration
framework: appkit
role: symbol
role_heading: Class
path: appkit/nscollectionviewcompositionallayoutconfiguration
---

# NSCollectionViewCompositionalLayoutConfiguration

An object that defines scroll direction, section spacing, and headers or footers for the layout.

## Declaration

```swift
@MainActor class NSCollectionViewCompositionalLayoutConfiguration
```

## Overview

Overview You use a layout configuration to modify a collection view layout’s default scroll direction, add extra spacing between each section of the layout, and add headers or footers to the entire layout. You can pass in this configuration when creating an NSCollectionViewCompositionalLayout, or you can set the configuration property on an existing layout. If you modify the configuration on an existing layout, the system invalidates the layout so that it will be updated with the new configuration. let headerFooterSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),                                              heightDimension: .estimated(44))

let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerFooterSize,                                                         elementKind: "header",                                                           alignment: .top) let footer = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerFooterSize,                                                         elementKind: "footer",                                                           alignment: .bottom)

let config = NSCollectionViewCompositionalLayoutConfiguration() config.interSectionSpacing = 20 config.scrollDirection = .horizontal config.boundarySupplementaryItems = [header, footer]

## Topics

### Specifying Scroll Direction

- [scrollDirection](appkit/nscollectionviewcompositionallayoutconfiguration/scrolldirection.md)

### Configuring Spacing

- [interSectionSpacing](appkit/nscollectionviewcompositionallayoutconfiguration/intersectionspacing.md)

### Configuring Additional Views

- [boundarySupplementaryItems](appkit/nscollectionviewcompositionallayoutconfiguration/boundarysupplementaryitems.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.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)

## See Also

### Layouts

- [Implementing modern collection views](uikit/implementing-modern-collection-views.md)
- [NSCollectionViewFlowLayout](appkit/nscollectionviewflowlayout.md)
- [NSCollectionViewDelegateFlowLayout](appkit/nscollectionviewdelegateflowlayout.md)
- [NSCollectionViewGridLayout](appkit/nscollectionviewgridlayout.md)
- [NSCollectionViewTransitionLayout](appkit/nscollectionviewtransitionlayout.md)
- [NSCollectionViewLayoutAttributes](appkit/nscollectionviewlayoutattributes.md)
- [NSCollectionViewLayout](appkit/nscollectionviewlayout.md)
- [NSCollectionViewCompositionalLayout](appkit/nscollectionviewcompositionallayout.md)
- [NSCollectionViewCompositionalLayoutSectionProvider](appkit/nscollectionviewcompositionallayoutsectionprovider.md)
- [NSCollectionLayoutSectionOrthogonalScrollingBehavior](appkit/nscollectionlayoutsectionorthogonalscrollingbehavior.md)
