TargetsEditorDataFlow.swift 876 B

12345678910111213141516171819202122232425262728293031323334
  1. import Foundation
  2. enum TargetsEditor {
  3. enum Config {}
  4. class Item: Identifiable, Hashable, Equatable {
  5. let id = UUID()
  6. var lowIndex = 0
  7. var highIndex = 0
  8. var timeIndex = 0
  9. init(lowIndex: Int, highIndex _: Int, timeIndex: Int) {
  10. self.lowIndex = lowIndex
  11. highIndex = lowIndex
  12. self.timeIndex = timeIndex
  13. }
  14. static func == (lhs: Item, rhs: Item) -> Bool {
  15. lhs.timeIndex == rhs.timeIndex && lhs.lowIndex == rhs.lowIndex && lhs.highIndex == rhs.highIndex
  16. }
  17. func hash(into hasher: inout Hasher) {
  18. hasher.combine(timeIndex)
  19. hasher.combine(lowIndex)
  20. hasher.combine(highIndex)
  21. }
  22. }
  23. }
  24. protocol TargetsEditorProvider: Provider {
  25. var profile: BGTargets { get }
  26. func saveProfile(_ profile: BGTargets)
  27. }