<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionLayoutGroup/horizontal(layoutSize:subitem:count:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCollectionLayoutGroup(cm)horizontalGroupWithLayoutSize:subitem:count:"
  },
  "title" : "horizontal(layoutSize:subitem:count:)"
}
-->

# horizontal(layoutSize:subitem:count:)

Creates a group of the specified size, containing an array of equally sized items arranged in a horizontal line up to the number specified by count.

```
class func horizontal(layoutSize: NSCollectionLayoutSize, subitem: NSCollectionLayoutItem, count: Int) -> Self
```

## Discussion

When you set a value for the [`interItemSpacing`](/documentation/AppKit/NSCollectionLayoutGroup/interItemSpacing) property after using this initializer, the group keeps the same number of items and automatically resizes them to add the extra specified spacing between them.

---

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)