IceCubesApp/IceCubesAppIntents/PostImageIntent.swift

24 lines
708 B
Swift
Raw Normal View History

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