IceCubes/IceCubesAppIntents/PostImageIntent.swift

20 lines
679 B
Swift
Raw 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-05-05 13:12:19 +02: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-05-02 11:37:38 +02:00
@Parameter(title: "Image",
description: "Image to post on Mastodon",
supportedTypeIdentifiers: ["public.image"],
inputConnectionBehavior: .connectToPreviousIntentResult)
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()
}
}