A type you use to donate your app's songs, albums, artists, and other media
items to play during workouts.
Use the shared `RelevantEntities` object to donate songs, albums, artists,
playlists, radio stations, podcasts, or other media-related content to the system.
Base your donations on whatever criteria makes sense for your app. For example, you
might donate songs that someone listens to frequently or donate new items that you
think someone might like based on their tastes. The system uses your donations to
offer suggestions for content someone can play during a workout or other scenario.
When you donate media items using this type, provide all the items at once using the
``RelevantEntities/updateSuggestedEntities(_:)`` method. Apps provide only one set
of suggestions at a time, and those suggestions remain active until you clear them. Each
time you call the ``RelevantEntities/updateSuggestedEntities(_:)`` method, the system
replaces your app's previous suggestions with the new set. If you don't have any suggestions,
you can specify an empty array when calling the method. If someone doesn't launch your app,
the system automatically expires your app's suggestions after approximately four weeks.
func removeEntities(_ entities: [any AppEntity], from context: AppEntityContext) async throws
Removes specific entities from the given context.
- Parameters:
- entities: The entities to remove.
- context: The context from which to remove the entities.
- Throws: An error if the removal fails.
Removes the specified entities across all contexts.
- Parameter entities: The entities to remove from all contexts.
- Throws: An error if the removal fails.
func updateEntities(_ entities: [any AppEntity], for context: AppEntityContext) async throws
Donates suggested entities for a single context.
Replaces any previously donated entities associated with the given context.
- Parameters:
- entities: The entities to donate.
- context: The context with which to associate the donated entities.
- Throws: An error if the donation fails.
Removes all donated entities for the given context.
- Parameter context: The context whose donated entities should be removed.
- Throws: An error if the removal fails.
method · iOS 27.0+
removeAllEntities
TypeScript
removeAllEntities(): Promise<void>
Swift declaration
func removeAllEntities() async throws
Removes all suggested entities across all contexts.
- Throws: An error if the removal fails.