<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UINib/init(nibName:bundle:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UINib(cm)nibWithNibName:bundle:"
  },
  "title" : "init(nibName:bundle:)"
}
-->

# init(nibName:bundle:)

Returns a nib object from the nib file in the specified bundle.

```
init(nibName name: String, bundle bundleOrNil: Bundle?)
```

## Parameters

`name`

The name of the nib file, without any leading path information.

`bundleOrNil`

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 [`UINib`](/documentation/UIKit/UINib) object. An exception is thrown if there were errors during initialization or the nib file could not be located.

## Discussion

The [`UINib`](/documentation/UIKit/UINib) object looks for the nib file in the bundle’s language-specific project directories first, followed by the `Resources` directory.

---

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)