<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: 9.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Bundle/init(url:)-3n9rf",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBundle(im)initWithURL:"
  },
  "title" : "init(url:)"
}
-->

# init(url:)

Returns an `NSBundle` object initialized to correspond to the specified file URL.

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

## Parameters

`url`

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

## Return Value

An `NSBundle` object initialized to correspond to @c url, or @c nil if @c url doesn’t exist or the user doesn’t have access to it.

## Discussion

This method initializes and returns a new instance only if there is no existing bundle associated with @c url,
otherwise it deallocates @c self and 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)