<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HomeKit",
  "identifier" : "/documentation/HomeKit/HMMediaSourceDisplayOrderProfile/writeOrder(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HomeKit"
    ],
    "preciseIdentifier" : "s:7HomeKit32HMMediaSourceDisplayOrderProfileC05writeF0yySaySiGYaKF"
  },
  "title" : "writeOrder(_:)"
}
-->

# writeOrder(_:)

Writes the display order of the media sources to the accessory.

```
func writeOrder(_ order: [Int]) async throws
```

## Parameters

`order`

The new display order for the media sources. Provides an ordered list of [`HMCharacteristicTypeIdentifier`](/documentation/HomeKit/HMCharacteristicTypeIdentifier) values for [`HMServiceTypeInputSource`](/documentation/HomeKit/HMServiceTypeInputSource) services associated with the profile.

## Discussion

An error is thrown if the source ordering fails to be written to the accessory.

---

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)