ISFEditorDataFlow.swift 679 B

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