I’m Having a problem with Ending a Live Activity form the Dynamic island, I tried Using a Button with an Intent but i couldn’t get it to Work Duo to Low resouces about the App Inents FrameWork.
@available(iOS 17.0, *)
struct EndActivity: AppIntent,LiveActivityIntent {
static var title: LocalizedStringResource = "End Live Activity"
func perform() async throws -> some IntentResult {
let content = MyWidgetsAttributes.ContentState()
DownloadsView().stopActiviry()
print("Activity Ended \n")
return .result()
}
}
The stopActiviry() function:
func stopActiviry(){
Task {
let content = MyWidgetsAttributes.ContentState()
await activity?.end(using: content,dismissalPolicy: .immediate)
print("Activity Ended \n")
}
}




