HKUnit.swift 620 B

12345678910111213141516171819202122232425
  1. //
  2. // HKUnit.swift
  3. // OmniKitUI
  4. //
  5. // Created by Pete Schwamb on 3/19/23.
  6. // Copyright © 2023 LoopKit Authors. All rights reserved.
  7. //
  8. import HealthKit
  9. extension HKUnit {
  10. static let milligramsPerDeciliter: HKUnit = {
  11. return HKUnit.gramUnit(with: .milli).unitDivided(by: .literUnit(with: .deci))
  12. }()
  13. static let millimolesPerLiter: HKUnit = {
  14. return HKUnit.moleUnit(with: .milli, molarMass: HKUnitMolarMassBloodGlucose).unitDivided(by: .liter())
  15. }()
  16. static let internationalUnitsPerHour: HKUnit = {
  17. return HKUnit.internationalUnit().unitDivided(by: .hour())
  18. }()
  19. }