<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WidgetKit",
  "identifier" : "/documentation/WidgetKit/ControlValueProvider",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "WidgetKit"
    ],
    "preciseIdentifier" : "s:9WidgetKit20ControlValueProviderP"
  },
  "title" : "ControlValueProvider"
}
-->

# ControlValueProvider

A type that provides a value to a control template.

```
protocol ControlValueProvider
```

## Overview

The provider quickly and cheaply prepares a synchronous value to be shown
while previewing the control in the add sheet. When the actual control needs
to be rendered, the actual, current value will be fetched asynchronously.

For instance, a control that opens and closes a garage door may show a
preview of the door being closed. When the actual control is rendered, the
control may fetch the door’s status from the cloud:

```
struct GarageDoorValueProvider: ControlValueProvider {
    var previewValue: Bool { false }

    func currentValue() async -> Bool {
        await GarageDoorManager.shared.doorStatus()
    }
}
```

---

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)