end(using:dismissalPolicy:)
Ends an active Live Activity.
Declaration
func end(using contentState: Activity<Attributes>.ContentState? = nil, dismissalPolicy: ActivityUIDismissalPolicy = .default) asyncParameters
- contentState:
The latest and final dynamic content for the Live Activity that ended. The size of the encoded content can’t exceed 4KB in size.
- dismissalPolicy:
Describes how and when the system should dismiss a Live Activity and and remove it from the Lock Screen.
Discussion
End an active Live Activity while your app is in the foreground or while it’s in the background — for example, by using Background Tasks.
Include updated data in the contentState parameter to ensure the Live Activity shows the latest and final content update after it ends. This is important because the Live Activity remains visible until the system or the person removes it.