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

# init(nibNamed:bundle:)

Returns an `NSNib` object initialized to the nib file in the specified bundle.

```
init?(nibNamed nibName: NSNib.Name, bundle: Bundle?)
```

## Parameters

`nibName`

The name of the nib file, without any leading path information. Inclusion of the `.nib` extension on the nib file name is optional.

`bundle`

The bundle in which to search for the nib file. If you specify `nil`, this method looks for the nib file in the main bundle.

## Return Value

The initialized `NSNib` object or `nil` if there were errors during initialization or the nib file could not be located.

## Discussion

The `NSNib` object looks for the nib file in the bundle’s language-specific project directories first, followed by the `Resources` directory.

After the nib file has been loaded, the `NSNib` object uses the bundle’s resource map to locate additional resources referenced by the nib. If you specified `nil` for the `bundle` parameter, the `NSNib` object looks for those resources in the bundle associated with the class of the nib file’s owner instead. If the nib file does not have an owner, the `NSNib` object looks for additional resources in the application’s main bundle.

---

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)