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

# init(contentsOf:)

Initializes a newly allocated array with the contents of the location specified by a given URL.

## Declaration

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

## Parameters

- `url`: The location of a file containing a string representation of an array produced by the writeToURL:atomically: method.

## Return Value

Return Value An array initialized to contain the contents specified by aURL. Returns nil if the location can’t be opened or if the contents of the location can’t be parsed into an array. The returned object might be different than the original receiver.

## Discussion

Discussion The array representation at the location identified by aURL must contain only property list objects (NSString, NSData, NSArray, or NSDictionary objects). The objects contained by this array are immutable, even if the array is mutable.
