liveactivity: fix deprecated end(using:dismissalPolicy:) warning (KC-64)
Omitting the content argument on activity.end(dismissalPolicy:) resolved to the deprecated iOS 16.1 overload. Pass nil explicitly to bind to end(content:dismissalPolicy:) instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2229,3 +2229,24 @@ unwanted friction, not a fix — restored the KC-52 behavior where Finish
|
||||
skips the dialog only when `done == total` (nothing to override at that
|
||||
point). Partial-completion "Finish Anyway" still confirms. The
|
||||
always-visible progress dots from this issue's first change are untouched.
|
||||
|
||||
## KC-64 — Xcode warning: deprecated `Activity.end(using:dismissalPolicy:)`
|
||||
|
||||
Status: Implemented (not build-verified — no iOS runtime here)
|
||||
Reported by: User, Xcode warning screenshot ("'end(using:dismissalPolicy:)'
|
||||
was deprecated in iOS 16.2: Use end(content:dismissalPolicy:)")
|
||||
Area: Live Activities
|
||||
|
||||
### Description
|
||||
Both Live Activity "stop" call sites called `activity.end(dismissalPolicy:
|
||||
.immediate)` with no content argument. ActivityKit has two overloads —
|
||||
`end(_:dismissalPolicy:)` (current) and the deprecated `end(using:
|
||||
dismissalPolicy:)` — and omitting the first argument entirely resolved to
|
||||
the deprecated one.
|
||||
|
||||
### Change
|
||||
Pass `nil` explicitly as the unlabeled first argument so it binds to the
|
||||
non-deprecated overload: `activity.end(nil, dismissalPolicy: .immediate)`.
|
||||
|
||||
Files: `KisaniCal/Managers/LiveActivityManager.swift`,
|
||||
`KisaniCalWidgets/StopCountdownIntent.swift`.
|
||||
|
||||
@@ -61,7 +61,7 @@ enum LiveActivityManager {
|
||||
Task {
|
||||
for activity in Activity<TaskActivityAttributes>.activities
|
||||
where activity.attributes.taskID == taskID {
|
||||
await activity.end(dismissalPolicy: .immediate)
|
||||
await activity.end(nil, dismissalPolicy: .immediate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ struct StopCountdownIntent: LiveActivityIntent {
|
||||
func perform() async throws -> some IntentResult {
|
||||
for activity in Activity<TaskActivityAttributes>.activities
|
||||
where activity.attributes.taskID == taskID {
|
||||
await activity.end(dismissalPolicy: .immediate)
|
||||
await activity.end(nil, dismissalPolicy: .immediate)
|
||||
}
|
||||
return .result()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user