Live activity and ActivityAuthorizationError.visibility in Appintent

Tobias Zimmermann1 minute reading time

Apple has a small limitation in AppIntents and that is you cannot easily launch a LiveActivity from an App Intent.

Error requesting Live Activity visibility.

Fortunately, it can be easily solved by adding ```LiveActivityStartingIntent`` as a protocol:

swift
import AppIntents
struct ShowACommentIntent: AppIntent, LiveActivityStartingIntent {
static var title: LocalizedStringResource = "Show a comment"
static var description = IntentDescription("Show a comment with configuration")
@Parameter(title: "Comment")
var comment: String?
func perform() async throws -> some IntentResult {
/// Do your thing
}
}