---
title: "writeOrder(_:)"
framework: homekit
role: symbol
role_heading: Instance Method
path: "homekit/hmmediasourcedisplayorderprofile/writeorder(_:)"
---

# writeOrder(_:)

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

## Declaration

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

## Parameters

- `order`: The new display order for the media sources. Provides an ordered list of doc://com.apple.homekit/documentation/HomeKit/HMCharacteristicTypeIdentifier values for doc://com.apple.homekit/documentation/HomeKit/HMServiceTypeInputSource services associated with the profile.

## Discussion

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

## See Also

### Managing input source order

- [delegate](homekit/hmmediasourcedisplayorderprofile/delegate-swift.property.md)
- [order](homekit/hmmediasourcedisplayorderprofile/order.md)
- [canModifyOrder](homekit/hmmediasourcedisplayorderprofile/canmodifyorder.md)
- [HMMediaSourceDisplayOrderProfile.Delegate](homekit/hmmediasourcedisplayorderprofile/delegate-swift.protocol.md)
