<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionLayoutItem/edgeSpacing",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCollectionLayoutItem(py)edgeSpacing"
  },
  "title" : "edgeSpacing"
}
-->

# edgeSpacing

The amount of space added around the boundaries of the item between other items and this item’s container.

```
@NSCopying var edgeSpacing: NSCollectionLayoutEdgeSpacing? { get set }
```

## Discussion

Use this property to adjust the position of the item in relation to its container and other items. For example, you can use this property to apply extra space to the trailing edge of each item. Edge spacing is applied before applying [`contentInsets`](/documentation/AppKit/NSCollectionLayoutItem/contentInsets).

The following diagram shows the result of applying 2 points of trailing edge spacing to the items in a group:

![Two diagrams that show the result of edge spacing applied to a group of items. The first diagram shows a group of three square items in a row, each item measuring 20 by 20 points. The second diagram shows a trailing edge spacing of 2 points applied to each item. Each item remains the same size, but moves 2 points if it’s on the trailing edge of the previous item in the group.](images/com.apple.appkit/media-3572326@2x.png)

---

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)