<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/init(coder:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)initWithCoder:"
  },
  "title" : "init(coder:)"
}
-->

# init(coder:)

Initializes a view using from data in the specified coder object.

```
init?(coder: NSCoder)
```

## Parameters

`coder`

The coder object that contains the view’s configuration details.

## Return Value

An initialized view or `nil` if AppKit couldn’t create the object.

---

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)