<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSNib/instantiate(withOwner:topLevelObjects:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSNib(im)instantiateWithOwner:topLevelObjects:"
  },
  "title" : "instantiate(withOwner:topLevelObjects:)"
}
-->

# instantiate(withOwner:topLevelObjects:)

Instantiates objects in the nib file with the specified owner.

```
func instantiate(withOwner owner: Any?, topLevelObjects: AutoreleasingUnsafeMutablePointer<NSArray?>?) -> Bool
```

## Parameters

`owner`

The object to set as the Nib’s owner (File’s Owner).

`topLevelObjects`

On return, an array containing the top-level objects of the nib.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the nib is instantiated; otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

Unlike legacy methods, the objects adhere to standard Cocoa memory management rules; it is necessary to keep a strong reference to the objects or 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.

---

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)