---
title: "init(url:fileType:)"
framework: avfoundation
role: symbol
role_heading: Initializer
path: "avfoundation/avassetwriter/init(url:filetype:)-xt34"
---

# init(url:fileType:)

Returns a new object that writes media data to a container file at the output URL.

## Declaration

```swift
convenience init(url outputURL: URL, fileType outputFileType: AVFileType) throws
```

## Parameters

- `outputURL`: The location of the file to write.
- `outputFileType`: The type of container file to write.

## Return Value

Return Value A new asset writer.

## Discussion

Discussion Writing fails if a file already exists at the output URL.

## See Also

### Creating an asset writer

- [init(outputURL:fileType:)](avfoundation/avassetwriter/init(outputurl:filetype:).md)
- [init(contentType:)](avfoundation/avassetwriter/init(contenttype:).md)
