<!--
{
  "availability" : [
    "macOS: 10.11.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionViewLayoutAttributes/init(forInterItemGapBefore:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCollectionViewLayoutAttributes(cm)layoutAttributesForInterItemGapBeforeIndexPath:"
  },
  "title" : "init(forInterItemGapBefore:)"
}
-->

# init(forInterItemGapBefore:)

Creates and returns a layout attributes object for an inter-item gap view at the specified index path.

```
convenience init(forInterItemGapBefore indexPath: IndexPath)
```

## Parameters

`indexPath`

The index path at which to insert the gap view. The gap is placed after the item specified by the index path. This parameter must contain a valid value.

## Return Value

A new layout attributes object configured with the initial attributes for the inter-item gap view.

## Discussion

Call this method when you need to create a layout attributes object for an inter-item gap view in a collection view. Gap views are used during drag and drop to indicate the area where content will drop. This method uses the parameters to set the initial values of the [`indexPath`](/documentation/AppKit/NSCollectionViewLayoutAttributes/indexPath) property of the returned object. The [`representedElementKind`](/documentation/AppKit/NSCollectionViewLayoutAttributes/representedElementKind) property is set to [`elementKindInterItemGapIndicator`](/documentation/AppKit/NSCollectionView/elementKindInterItemGapIndicator).

---

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)