<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ModelIO",
  "identifier" : "/documentation/ModelIO/MDLAsset/export(to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)MDLAsset(im)exportAssetToURL:error:"
  },
  "title" : "export(to:)"
}
-->

# export(to:)

Writes asset data to a file at the specified URL and reports errors that occur during export.

```
func export(to URL: URL) throws
```

## Parameters

`URL`

A URL specifying the location to export asset data to. This parameter must be a `file:` URL.

## Discussion

The [`MDLAsset`](/documentation/ModelIO/MDLAsset) class infers the data format to export in from the <doc://com.apple.documentation/documentation/Foundation/NSURL/pathExtension> property of the specified URL. To determine whether a format is supported for export, call the [`canExportFileExtension(_:)`](/documentation/ModelIO/MDLAsset/canExportFileExtension(_:)) method.

---

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)