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

# initWithContentsOfURL:

Returns an `NSNib` object initialized to the nib file at the specified URL.

```
- (id) initWithContentsOfURL:(NSURL *) nibFileURL;
```

## Parameters

`nibFileURL`

The location of the nib file.

## Return Value

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

## Discussion

When you instantiate the nib objects later, the `NSNib` object looks for an appropriate bundle from which to search for any additional resources referenced by the nib. Because you do not specify a bundle directory when calling this method, the receiver uses the bundle associated with the class of the nib file’s owner. If the nib file does not have an owner, the receiver uses the application’s main bundle instead.

## See Also

  [Resource Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/LoadingResources/Introduction/Introduction.html#//apple_ref/doc/uid/10000051i)



---

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)