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

# hasEqualSpacing

A Boolean value that indicates whether the spacing between adjacent views should be equal to each other.

```
var hasEqualSpacing: Bool { get set }
```

## Discussion

The distances between adjacent views in a stack view are either constrained to equal each other or settable to custom spacings using the [`setCustomSpacing(_:after:)`](/documentation/AppKit/NSStackView/setCustomSpacing(_:after:)) method. The default value for the [`hasEqualSpacing`](/documentation/AppKit/NSStackView/hasEqualSpacing) property is <doc://com.apple.documentation/documentation/Swift/false>, which enables custom spacing. To require equal spacing, set this property to <doc://com.apple.documentation/documentation/Swift/true>, which disables the [`setCustomSpacing(_:after:)`](/documentation/AppKit/NSStackView/setCustomSpacing(_:after:)) method.

With [`hasEqualSpacing`](/documentation/AppKit/NSStackView/hasEqualSpacing) set to <doc://com.apple.documentation/documentation/Swift/false> (the default), the Auto Layout constraints for spacing between views in a gravity area are as shown in the table of the [`spacing`](/documentation/AppKit/NSStackView/spacing) property.

If you specify equal spacing, the system changes these constraints to the values shown in the table below.

|Constraint                                                                                              |Value for constraint priority|
|--------------------------------------------------------------------------------------------------------|-----------------------------|
|inter-view spacing `==` the ``doc://com.apple.appkit/documentation/AppKit/NSStackView/spacing`` property|hugging priority             |
|inter-view spacing `≥` the ``doc://com.apple.appkit/documentation/AppKit/NSStackView/spacing`` property |NSLayoutPriorityRequired     |
|Equal inter-view spacing                                                                                |NSLayoutPriorityDefaultLow   |

Stack view hugging priority, identified as the constraint value in row 1, has the default value [`defaultLow`](/documentation/AppKit/NSLayoutConstraint/Priority-swift.struct/defaultLow). You can adjust hugging priority by using the [`setHuggingPriority(_:for:)`](/documentation/AppKit/NSStackView/setHuggingPriority(_:for:)) method.

## See Also

[`setHuggingPriority(_:for:)`](/documentation/AppKit/NSStackView/setHuggingPriority(_:for:))

Sets the Auto Layout priority for the stack view to minimize its size, for a specified user interface axis.



---

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)