---
title: "writeValue(_:completionHandler:)"
framework: homekit
role: symbol
role_heading: Instance Method
path: "homekit/hmcharacteristic/writevalue(_:completionhandler:)"
---

# writeValue(_:completionHandler:)

Modifies the value of the characteristic.

## Declaration

```swift
func writeValue(_ value: Any?, completionHandler completion: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func writeValue(_ value: Any?) async throws
```

## Parameters

- `value`: The new value.
- `completion`: The block executed after the request is processed.

## See Also

### Controlling a characteristic

- [value](homekit/hmcharacteristic/value.md)
- [readValue(completionHandler:)](homekit/hmcharacteristic/readvalue(completionhandler:).md)
- [updateAuthorizationData(_:completionHandler:)](homekit/hmcharacteristic/updateauthorizationdata(_:completionhandler:).md)
