<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Bundle/init(url:)-a2t0",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBundle(cm)bundleWithURL:"
  },
  "title" : "init(url:)"
}
-->

# init(url:)

Returns an `NSBundle` object that corresponds to the specified file URL.

```
convenience init?(url: URL)
```

## Parameters

`url`

The URL to a directory. This must be a URL for a directory; if it contains any symbolic links, they must be resolvable.

## Return Value

The `NSBundle` object that corresponds to `url`, or `nil` if `url` does not identify an accessible bundle directory.

## Discussion

This method allocates and initializes the returned object if there is no existing `NSBundle` associated with `url`, in which case it returns the existing object.

---

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)