ListOverridePresetIntent.swift 984 B

12345678910111213141516171819202122232425262728293031
  1. import AppIntents
  2. import Foundation
  3. @available(iOS 16.0, *) struct ListOverridePresetsIntent: AppIntent {
  4. // Title of the action in the Shortcuts app
  5. static var title = LocalizedStringResource("List overrides", table: "ShortcutsDetail")
  6. // Description of the action in the Shortcuts app
  7. static var description = IntentDescription(
  8. .init(
  9. "Allow to list and choose a specific override",
  10. table: "ShortcutsDetail"
  11. )
  12. )
  13. @Parameter(
  14. title: LocalizedStringResource("Override", table: "ShortcutsDetail"),
  15. description: LocalizedStringResource("Override choice", table: "ShortcutsDetail")
  16. ) var preset: OverridePreset?
  17. static var parameterSummary: some ParameterSummary {
  18. Summary("Choose the override \(\.$preset)", table: "ShortcutsDetail")
  19. }
  20. @MainActor func perform() async throws -> some ReturnsValue<OverridePreset> {
  21. .result(
  22. value: preset!
  23. )
  24. }
  25. }