<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Bundle/loadNibNamed(_:owner:topLevelObjects:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBundle(im)loadNibNamed:owner:topLevelObjects:"
  },
  "title" : "loadNibNamed(_:owner:topLevelObjects:)"
}
-->

# loadNibNamed(_:owner:topLevelObjects:)

Loads a nib from the bundle with the specified file name and owner.

```
func loadNibNamed(_ nibName: NSNib.Name, owner: Any?, topLevelObjects: AutoreleasingUnsafeMutablePointer<NSArray?>?) -> Bool
```

## Parameters

`nibName`

The name of the nib.

`owner`

The object that will be the nib’s owner.

`topLevelObjects`

This by-reference parameter is populated with the top level objects of the nib.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the nib file was loaded successfully; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

Unlike legacy methods, the objects adhere to the standard cocoa memory management rules; it is necessary to keep a strong reference to them by using IBOutlets or holding a reference to the array to prevent the nib contents from being deallocated.

Outlets to top-level objects should be strong references to demonstrate ownership and prevent deallocation.

For more information on Nibs, see <doc://com.apple.documentation/documentation/AppKit/NSNib>.

---

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)