---
title: "init(contentsOf:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsdictionary/init(contentsof:)"
---

# init(contentsOf:)

Initializes a newly allocated dictionary using the keys and values found at a given URL.

## Declaration

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

## Parameters

- `url`: An URL that identifies a resource containing a string representation of a property list whose root object is a dictionary.

## Return Value

Return Value An initialized dictionary—which might be different than the original receiver—that contains the dictionary at url, or nil if there is an error or if the contents of the resource are an invalid representation of a dictionary.

## Discussion

Discussion The dictionary representation in the file identified by url must contain only property list objects (NSString, NSData, NSDate, NSNumber, NSArray, or NSDictionary objects). For more details, see Property List Programming Guide. The objects contained by this dictionary are immutable, even if the dictionary is mutable. note: Use init(contentsOfURL:error:) instead.
