IceCubesApp/IceCubesAppIntents/PostImageIntent.swift

20 lines
679 B
Swift
Raw Normal View History

2024-05-02 09:37:38 +00:00
import AppIntents
2024-05-04 11:19:19 +00:00
import Foundation
2024-05-02 09:37:38 +00:00
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"
2024-05-05 11:12:19 +00:00
static let description: IntentDescription = "Use Ice Cubes to compose a post with an image to Mastodon"
2024-05-02 09:37:38 +00:00
static let openAppWhenRun: Bool = true
2024-05-04 11:19:19 +00:00
2024-05-02 09:37:38 +00:00
@Parameter(title: "Image",
description: "Image to post on Mastodon",
supportedTypeIdentifiers: ["public.image"],
inputConnectionBehavior: .connectToPreviousIntentResult)
var images: [IntentFile]?
2024-05-04 11:19:19 +00:00
2024-05-02 09:37:38 +00:00
func perform() async throws -> some IntentResult {
AppIntentService.shared.handledIntent = .init(intent: self)
return .result()
}
}