tempPresetIntent.swift 861 B

1234567891011121314151617181920212223242526272829303132
  1. import AppIntents
  2. import Foundation
  3. import Intents
  4. import Swinject
  5. @available(iOS 16.0, *) struct tempPreset: AppEntity, Identifiable {
  6. static var defaultQuery = tempPresetsQuery()
  7. var id: UUID
  8. var name: String
  9. var targetTop: Decimal?
  10. var targetBottom: Decimal?
  11. var duration: Decimal
  12. var displayRepresentation: DisplayRepresentation {
  13. DisplayRepresentation(title: "\(name)")
  14. }
  15. static var typeDisplayRepresentation: TypeDisplayRepresentation = "Presets"
  16. static func convert(_ tempTarget: TempTarget) -> tempPreset {
  17. var tp = tempPreset(
  18. id: UUID(uuidString: tempTarget.id)!,
  19. name: tempTarget.displayName,
  20. duration: tempTarget.duration
  21. )
  22. tp.targetTop = tempTarget.targetTop
  23. tp.targetBottom = tempTarget.targetBottom
  24. return tp
  25. }
  26. }