IceCubes/IceCubesAppIntents/PostImageIntent.swift

22 lines
661 B
Swift
Raw Permalink Normal View History

2024-05-02 11:37:38 +02:00
import AppIntents
2024-05-04 13:19:19 +02:00
import Foundation
2024-05-02 11:37:38 +02:00
2024-05-04 11:34:51 +02:00
struct PostImageIntent: AppIntent {
2024-05-02 11:37:38 +02:00
static let title: LocalizedStringResource = "Post an image to Mastodon"
2024-10-28 10:57:48 +01:00
static let description: IntentDescription =
"Use Ice Cubes to compose a post with an image to Mastodon"
2024-05-02 11:37:38 +02:00
static let openAppWhenRun: Bool = true
2024-05-04 13:19:19 +02:00
2024-10-28 10:57:48 +01:00
@Parameter(
title: "Image",
description: "Image to post on Mastodon",
supportedTypeIdentifiers: ["public.image"],
inputConnectionBehavior: .connectToPreviousIntentResult)
2024-05-02 11:37:38 +02:00
var images: [IntentFile]?
2024-05-04 13:19:19 +02:00
2024-05-02 11:37:38 +02:00
func perform() async throws -> some IntentResult {
AppIntentService.shared.handledIntent = .init(intent: self)
return .result()
}
}