An object that describes the relative importance of a timeline entry
compared to other entries in the current and past timelines.
When users put widgets into a Smart Stack, WidgetKit uses the
<doc:TimelineEntry/relevance-2oovl> property of the entries your timeline
provider generates to determine how relevant they are to the user. For
each timeline entry that your provider creates, you may assign relevance
that contains a <doc:TimelineEntryRelevance/score> and a
<doc:TimelineEntryRelevance/duration>. The score is a value you choose that
indicates the relevance of the widget, relative to entries across timelines
that the provider creates. When the date of an entry arrives, and for the
duration you specify, WidgetKit may rotate your widget to the top of the
stack so it becomes visible.
A timeline entry's assigned relevance isn't the only factor that determines
whether WidgetKit rotates your widget to the top of the
Smart Stack. For more information, see <doc:Widget-Suggestions-In-Smart-Stacks>.
Creates an object that represents the importance of a widget and the
length of time for WidgetKit to consider it for rotation to the top of
the stack.
- Parameters:
- score: A value on a scale of your choosing, indicating the
importance of an entry compared to other entries in the same
timeline.
- duration: The number of seconds following an entry's date that
WidgetKit may rotate the widget to the top of the stack.
get · iOS 14.0+
score
TypeScript
get score(): number
Swift declaration
var score: Float
A value that indicates the relevance of an entry compared to other
entries in the current and past timelines.
set · iOS 14.0+
score
TypeScript
set score(value: number)
Swift declaration
var score: Float
A value that indicates the relevance of an entry compared to other
entries in the current and past timelines.
get · iOS 14.0+
duration
TypeScript
get duration(): number
Swift declaration
var duration: TimeInterval
The number of seconds, following an entry's date, that WidgetKit considers
the widget for rotation to the top of the stack.
set · iOS 14.0+
duration
TypeScript
set duration(value: number)
Swift declaration
var duration: TimeInterval
The number of seconds, following an entry's date, that WidgetKit considers
the widget for rotation to the top of the stack.