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

# init(contentsOf:)

Provides data-backed content from an existing file.

## Declaration

```swift
convenience init?(contentsOf fileURL: URL!)
```

## Parameters

- `fileURL`: The URL of the file to use for the item provider’s data. The item provider uses the filename extension to determine the universal type identifier for the associated data.

## Return Value

Return Value An item provider for the specified file, or nil if an error occurs.

## Discussion

Discussion The system uses the URL’s filename extension to select an appropriate universal type identifier. If the system can’t determine a specific universal type identifier based on the filename extension, it assigns the public.data universal type identifier for the file.

## See Also

### Related Documentation

- [App Extension Programming Guide](apple-archive/documentation/General/Conceptual/ExtensibilityPG.md)

### Creating an item provider

- [init(contentsOf:contentType:openInPlace:coordinated:visibility:)](foundation/nsitemprovider/init(contentsof:contenttype:openinplace:coordinated:visibility:).md)
- [init(item:typeIdentifier:)](foundation/nsitemprovider/init(item:typeidentifier:).md)
- [init()](foundation/nsitemprovider/init().md)
- [init(object:)](foundation/nsitemprovider/init(object:).md)
