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

# init(views:)

Creates and returns a stack view with a specified array of views.

```
convenience init(views: [NSView])
```

## Parameters

`views`

The array of views for the new stack view.

## Return Value

A stack view initialized with the specified array of views.

## Discussion

The returned stack view has horizontal layout direction and its [`translatesAutoresizingMaskIntoConstraints`](/documentation/AppKit/NSView/translatesAutoresizingMaskIntoConstraints) property is set to the Boolean value <doc://com.apple.documentation/documentation/Swift/false>. The views you provide in the `views` parameter are placed into the stack view’s leading gravity area.

## See Also

  [View Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CocoaViewsGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40002978)

[`NSLayoutConstraint`](/documentation/AppKit/NSLayoutConstraint)

The relationship between two user interface objects that must be satisfied by the constraint-based layout system.



---

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)