---
title: "instantiate(withOwner:topLevelObjects:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsnib/instantiate(withowner:toplevelobjects:)"
---

# instantiate(withOwner:topLevelObjects:)

Instantiates objects in the nib file with the specified owner.

## Declaration

```swift
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

Return Value true if the nib is instantiated; otherwise false.

## Discussion

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.
