<!--
{
  "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/NSCollectionLayoutSection",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCollectionLayoutSection"
  },
  "title" : "NSCollectionLayoutSection"
}
-->

# NSCollectionLayoutSection

A container that combines a set of groups into distinct visual groupings.

```
@MainActor class NSCollectionLayoutSection
```

## Overview

A collection view layout has one or more sections. Sections provide a way to separate the layout into distinct pieces.

Each section can have the same layout or a different layout than the other sections in the collection view. A section’s layout is determined by the properties of the group ([`NSCollectionLayoutGroup`](/documentation/UIKit/NSCollectionLayoutGroup)) that’s used to create the section.

In the Photos app, each section in the Years page uses the same layout. In the App Store, the Apps page displays several sections with different content arrangements.

![Schematic representation of the App Store app on iOS, showing a collection view with a compositional layout. The layout is composed of two horizontally-scrolling sections that have different layouts. The top section shows one group with one item visible onscreen, with other groups peeking in from the sides of the screen. The bottom section shows one group that’s a column of three cells, each of those cells being an item. The two different sections are highlighted and labeled as sections.](images/com.apple.uikit/media-3568661@2x.png)

Each section can have its own background, header, and footer to distinguish it from other sections.

## Topics

### Creating a section

[`convenience init(group: NSCollectionLayoutGroup)`](/documentation/UIKit/NSCollectionLayoutSection/init(group:))

Creates a section containing the specified group.

[`static func list(using: UICollectionLayoutListConfiguration, layoutEnvironment: any NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection`](/documentation/UIKit/NSCollectionLayoutSection/list(using:layoutEnvironment:))

Creates a list section with the specified list configuration and layout environment.

[`+ (instancetype) sectionWithListConfiguration:(UICollectionLayoutListConfiguration *) configuration layoutEnvironment:(id<NSCollectionLayoutEnvironment>) layoutEnvironment;`](/documentation/UIKit/NSCollectionLayoutSection/sectionWithListConfiguration:layoutEnvironment:)

Creates a list section with the specified list configuration and layout environment.

[`class func orthogonalLayoutSectionForMediaItems() -> NSCollectionLayoutSection`](/documentation/UIKit/NSCollectionLayoutSection/orthogonalLayoutSectionForMediaItems())

Creates an orthogonally scrolling section with system default spacing.

### Specifying scrolling behavior

[`var orthogonalScrollingBehavior: UICollectionLayoutSectionOrthogonalScrollingBehavior`](/documentation/UIKit/NSCollectionLayoutSection/orthogonalScrollingBehavior)

The section’s scrolling behavior in relation to the main layout axis.

[`var orthogonalScrollingProperties: UICollectionLayoutSectionOrthogonalScrollingProperties`](/documentation/UIKit/NSCollectionLayoutSection/orthogonalScrollingProperties)

The section’s orthogonal scrolling properties.

[`class UICollectionLayoutSectionOrthogonalScrollingProperties`](/documentation/UIKit/UICollectionLayoutSectionOrthogonalScrollingProperties)

An object that specifies properties for a layout section that scrolls orthogonally in relation to the main layout axis.

### Configuring section spacing

[`var interGroupSpacing: CGFloat`](/documentation/UIKit/NSCollectionLayoutSection/interGroupSpacing)

The amount of space between the groups in the section.

[`var contentInsets: NSDirectionalEdgeInsets`](/documentation/UIKit/NSCollectionLayoutSection/contentInsets)

The amount of space between the content of the section and its boundaries.

[`var contentInsetsReference: UIContentInsetsReference`](/documentation/UIKit/NSCollectionLayoutSection/contentInsetsReference)

The boundary to reference when defining content insets.

[`var supplementaryContentInsetsReference: UIContentInsetsReference`](/documentation/UIKit/NSCollectionLayoutSection/supplementaryContentInsetsReference)

The reference boundary for content insets on boundary supplementary items.

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

Constants that describe the reference point of the content insets.

### Configuring additional views

[`var boundarySupplementaryItems: [NSCollectionLayoutBoundarySupplementaryItem]`](/documentation/UIKit/NSCollectionLayoutSection/boundarySupplementaryItems)

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

[`var decorationItems: [NSCollectionLayoutDecorationItem]`](/documentation/UIKit/NSCollectionLayoutSection/decorationItems)

An array of the decoration items that are anchored to the section, such as background decoration views.

### Rendering items

[`var visibleItemsInvalidationHandler: NSCollectionLayoutSectionVisibleItemsInvalidationHandler?`](/documentation/UIKit/NSCollectionLayoutSection/visibleItemsInvalidationHandler)

A closure called before each layout cycle to allow modification of the items in the section immediately before they’re displayed.

### Deprecated

[`var supplementariesFollowContentInsets: Bool`](/documentation/UIKit/NSCollectionLayoutSection/supplementariesFollowContentInsets)

A Boolean value that indicates whether the section’s supplementary items follow the specified content insets for the section.

## Relationships

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`Sendable`](/documentation/Swift/Sendable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)