<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "swift: -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSMutableArray/init(contentsOfURL:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMutableArray(cm)arrayWithContentsOfURL:::SYNTHESIZED::c:objc(cs)NSMutableArray"
  },
  "title" : "init(contentsOfURL:)"
}
-->

# init(contentsOfURL:)

Creates and returns a mutable array containing the contents specified by a given URL.

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

## Parameters

`url`

The location of the file containing a string representation of a mutable array produced by the [`write(to:atomically:)`](/documentation/Foundation/NSArray/write(to:atomically:)) method.

## Return Value

A mutable array containing 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 a mutable array.

## Discussion

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

## See Also

[`-  writeToURL:atomically:`](/documentation/Foundation/NSArray/write(to:atomically:))

Writes the contents of the array to the location specified by a given URL.



---

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)