<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionLayoutContainer",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSCollectionLayoutContainer"
  },
  "title" : "NSCollectionLayoutContainer"
}
-->

# NSCollectionLayoutContainer

A protocol used to provide information about the size and content insets of a layout’s container.

```
@MainActor protocol NSCollectionLayoutContainer : NSObjectProtocol
```

## Overview

In a section provider, you use the [`container`](/documentation/AppKit/NSCollectionLayoutEnvironment/container) property of the layout environment ([`NSCollectionLayoutEnvironment`](/documentation/AppKit/NSCollectionLayoutEnvironment)) to get information about the container of the layout, such as its size and content insets. Knowing about the container’s size while rendering the layout’s sections helps you make decisions about how to display the layout.

## Topics

### Getting content size

[`var contentSize: NSSize`](/documentation/AppKit/NSCollectionLayoutContainer/contentSize)

The size of the container before content insets are applied.

[`var effectiveContentSize: NSSize`](/documentation/AppKit/NSCollectionLayoutContainer/effectiveContentSize)

The size of the container after content insets are applied.

### Getting content insets

[`var contentInsets: NSDirectionalEdgeInsets`](/documentation/AppKit/NSCollectionLayoutContainer/contentInsets)

The amount of space added around the content of the container to adjust its final size.

[`var effectiveContentInsets: NSDirectionalEdgeInsets`](/documentation/AppKit/NSCollectionLayoutContainer/effectiveContentInsets)

The amount of space added around the content of the container to adjust its final size after item content insets are applied.

## Relationships

### Inherits From

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

---

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)