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

# UICollectionViewCompositionalLayout

A layout object that lets you combine items in highly adaptive and flexible visual arrangements.

```
@MainActor class UICollectionViewCompositionalLayout
```

## Overview

A compositional layout is a type of collection view layout. It’s designed to be composable, flexible, and fast, letting you build any kind of visual arrangement for your content by combining — or compositing — each smaller component into a full layout.

A compositional layout is composed of one or more sections that break up the layout into distinct visual groupings. Each section is composed of groups of individual items, the smallest unit of data you want to present. A group might lay out its items in a horizontal row, a vertical column, or a custom arrangement.

![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 side of the screen. The bottom section shows one group that’s a column of three cells, each of those cells being an item. Each of the items, groups, and sections are outlined and labeled to show how the pieces fit together.](images/com.apple.uikit/media-3568664@2x.png)

You combine the components by building up from items into a group, from groups into a section, and finally into a full layout, like in this example of a basic list layout:

```swift
func createBasicListLayout() -> UICollectionViewLayout { 
    let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),                                  
                                         heightDimension: .fractionalHeight(1.0))    
    let item = NSCollectionLayoutItem(layoutSize: itemSize)  
  
    let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),                                          
                                          heightDimension: .absolute(44))    
    let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize,                                                   
                                                     subitems: [item])  
  
    let section = NSCollectionLayoutSection(group: group)    


    let layout = UICollectionViewCompositionalLayout(section: section)    
    return layout
}
```

## Topics

### Creating a layout

[`-  initWithSection:`](/documentation/UIKit/UICollectionViewCompositionalLayout/init(section:))

Creates a compositional layout object with a single section.

[`-  initWithSection:configuration:`](/documentation/UIKit/UICollectionViewCompositionalLayout/init(section:configuration:))

Creates a compositional layout object with a single section and an additional configuration.

[`-  initWithSectionProvider:`](/documentation/UIKit/UICollectionViewCompositionalLayout/init(sectionProvider:))

Creates a compositional layout object with a section provider to supply the layout’s sections.

[`-  initWithSectionProvider:configuration:`](/documentation/UIKit/UICollectionViewCompositionalLayout/init(sectionProvider:configuration:))

Creates a compositional layout object with a section provider and an additional configuration.

### Creating a list layout

[`list(using:)`](/documentation/UIKit/UICollectionViewCompositionalLayout/list(using:))

Creates a compositional layout that contains only list sections of the specified configuration.

[`UICollectionLayoutListConfiguration`](/documentation/UIKit/UICollectionLayoutListConfiguration-swift.struct)

A configuration for creating a list layout.

[`+  layoutWithListConfiguration:`](/documentation/UIKit/UICollectionViewCompositionalLayout/layoutWithListConfiguration:)

Creates a compositional layout that contains only list sections of the specified configuration.

[`UICollectionLayoutListConfiguration`](/documentation/UIKit/UICollectionLayoutListConfiguration-c.class)

A configuration for creating a list layout.

### Configuring the layout

[`configuration`](/documentation/UIKit/UICollectionViewCompositionalLayout/configuration)

The layout’s configuration, such as its scroll direction and section spacing.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

### Inherits From

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

---

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)