<!--
{
  "availability" : [
    "iOS: 8.0.0 - 26.0.0",
    "iPadOS: 8.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.8.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0",
    "watchOS: 3.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SceneKit",
  "identifier" : "/documentation/SceneKit/SCNScene/write(to:options:delegate:progressHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SceneKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SCNScene(im)writeToURL:options:delegate:progressHandler:"
  },
  "title" : "write(to:options:delegate:progressHandler:)"
}
-->

# write(to:options:delegate:progressHandler:)

Exports the scene and its contents to a file at the specified URL.

```
func write(to url: URL, options: [String : Any]? = nil, delegate: (any SCNSceneExportDelegate)?, progressHandler: SCNSceneExportProgressHandler? = nil) -> Bool
```

## Parameters

`url`

The URL to write the scene file to. This URL must use the `file` scheme.

`options`

A dictionary of options affecting scene loading, or `nil` for default options. For available keys, see Scene Loading Options.

`delegate`

A delegate object to customize export of external resources used by the scene. Pass `nil` for default export of external resources.

`progressHandler`

A block that SceneKit calls repeatedly to report progress of the export operation.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if exporting the scene was successful; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

The format of the output file depends on OS and argument file extension:

- In iOS 10.0, tvOS 10.0, watchOS 3.0, OS X v10.11, and later versions, specify the `.scn` extension to save a file in SceneKit’s native format. This format supports all features of SceneKit (including physics, constraints, and particle systems), and reading files in this format is faster than importing from other scene file formats.
- In macOS only, specify the `.dae` extension to export in Digital Asset Exchange (DAE) format for use by other apps. Exported DAE files do not contain scene elements specific to SceneKit, such as physics bodies and fields, constraints, and particle systems.

Older versions of iOS and tvOS don’t include the [`write(to:options:delegate:progressHandler:)`](/documentation/SceneKit/SCNScene/write(to:options:delegate:progressHandler:)) method, but you can still produce a file in `.scn` format through SceneKit’s support for the <doc://com.apple.documentation/documentation/Foundation/NSSecureCoding> protocol. Use the <doc://com.apple.documentation/documentation/Foundation/NSKeyedArchiver> class to serialize a scene and all its contents, and the <doc://com.apple.documentation/documentation/Foundation/NSKeyedUnarchiver> class to load an archived scene.

If the scene references external resources, such as image files used in material properties, SceneKit exports these files to a nearby location and references their URLs in the exported scene file. To override SceneKit’s exporting of external resources, provide an object implementing the [`SCNSceneExportDelegate`](/documentation/SceneKit/SCNSceneExportDelegate) protocol in the `delegate` parameter.

---

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)