CREditorProvider.swift 622 B

1234567891011121314151617181920
  1. import Combine
  2. extension CREditor {
  3. final class Provider: BaseProvider, CREditorProvider {
  4. var profile: CarbRatios {
  5. storage.retrieve(OpenAPS.Settings.carbRatios, as: CarbRatios.self)
  6. ?? CarbRatios(from: OpenAPS.defaults(for: OpenAPS.Settings.carbRatios))
  7. ?? CarbRatios(units: .grams, schedule: [])
  8. }
  9. func saveProfile(_ profile: CarbRatios) {
  10. storage.save(profile, as: OpenAPS.Settings.carbRatios)
  11. }
  12. var autotune: Autotune? {
  13. storage.retrieve(OpenAPS.Settings.autotune, as: Autotune.self)
  14. }
  15. }
  16. }