<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionViewCompositionalLayoutConfiguration",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UICollectionViewCompositionalLayoutConfiguration"
  },
  "title" : "UICollectionViewCompositionalLayoutConfiguration"
}
-->

# UICollectionViewCompositionalLayoutConfiguration

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

```
@MainActor class UICollectionViewCompositionalLayoutConfiguration
```

## 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 a [`UICollectionViewCompositionalLayout`](/documentation/UIKit/UICollectionViewCompositionalLayout), or you can set the [`configuration`](/documentation/UIKit/UICollectionViewCompositionalLayout/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.

```swift
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 = UICollectionViewCompositionalLayoutConfiguration()
config.interSectionSpacing = 20
config.scrollDirection = .horizontal
config.boundarySupplementaryItems = [header, footer]
```

## Topics

### Specifying scroll direction

[`scrollDirection`](/documentation/UIKit/UICollectionViewCompositionalLayoutConfiguration/scrollDirection)

The axis that the content in the collection view layout scrolls along.

### Configuring spacing

[`interSectionSpacing`](/documentation/UIKit/UICollectionViewCompositionalLayoutConfiguration/interSectionSpacing)

The amount of space between the sections in the layout.

[`contentInsetsReference`](/documentation/UIKit/UICollectionViewCompositionalLayoutConfiguration/contentInsetsReference)

The boundary to reference when defining content insets.

[`UIContentInsetsReference`](/documentation/UIKit/UIContentInsetsReference)

Constants that describe the reference point of the content insets.

### Configuring additional views

[`boundarySupplementaryItems`](/documentation/UIKit/UICollectionViewCompositionalLayoutConfiguration/boundarySupplementaryItems)

An array of the supplementary items that are associated with the boundary edges of the entire layout, such as global headers and footers.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)