<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLRecommender/write(toFile:metadata:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Create ML",
      "CreateML"
    ],
    "preciseIdentifier" : "s:8CreateML13MLRecommenderV5write6toFile8metadataySS_AA15MLModelMetadataVSgtKF"
  },
  "title" : "write(toFile:metadata:)"
}
-->

# write(toFile:metadata:)

Exports the recommender as a Core ML model file at the given file path.

```
func write(toFile path: String, metadata: MLModelMetadata? = nil) throws
```

## Parameters

`path`

A file system path where the model file should be written.

`metadata`

Descriptive information to include with the exported model file.

---

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)