---
title: "init(identifier:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/bundle/init(identifier:)"
---

# init(identifier:)

Returns the NSBundle instance that has the specified bundle identifier.

## Declaration

```swift
init?(identifier: String)
```

## Parameters

- `identifier`: The identifier for an existing NSBundle instance.

## Return Value

Return Value The NSBundle object with the bundle identifier identifier, or nil if the requested bundle is not found on the system. This method creates and returns a new NSBundle object if there is no existing bundle associated with identifier. Otherwise, the existing instance is returned.

## Discussion

Discussion This method is typically used by frameworks and plug-ins to locate their own bundle at runtime. This method may be somewhat more efficient than trying to locate the bundle using the init(for:) method. However, if the initial lookup of an already loaded and cached bundle with the specified identifier fails, this method uses potentially time-consuming heuristics to attempt to locate the bundle. As an optimization, you can use the bundleWithPath: or init(url:) method instead to avoid file system traversal.

## See Also

### Creating and initializing a bundle

- [init(url:)](foundation/bundle/init(url:)-a2t0.md)
- [init(for:)](foundation/bundle/init(for:).md)
- [init(path:)](foundation/bundle/init(path:).md)
