---
title: "sleep(_:)"
framework: relevancekit
role: symbol
role_heading: Type Method
path: "relevancekit/relevantcontext/sleep(_:)"
---

# sleep(_:)

Tells the system a widget is relevant because of a person’s sleep schedule.

## Declaration

```swift
static func sleep(_ condition: RelevantContext.SleepCondition) -> RelevantContext
```

## Parameters

- `condition`: A value that describes a person’s typical bedtime or wakeup time.

## Return Value

Return Value A contextual clue that the system uses to determine the relevance of a widget in the Smart Stack on Apple Watch.

## Discussion

Discussion To indicate relevance based on a sleep condition, request the sleepAnalysis permission. If contextual sleep information isn’t available to the system, sleep clues to signal relevance don’t have an effect. For more information about requesting HealthKit permissions, refer to Authorizing access to health data. note: Smart Stacks are available in iOS, iPadOS, and watchOS. However, functionality provided by RelevanceKit API is only available in watchOS. Calling its API on other platforms doesn’t have any effect. For more information, refer to Increasing the visibility of widgets in Smart Stacks.

## See Also

### Sleep clues

- [RelevantContext.SleepCondition](relevancekit/relevantcontext/sleepcondition.md)
