 @available(iOS 9.0, *)
 public extension HKSampleType {
 
-    public var defaultUnit: HKUnit? {
-//        let isMetric: Bool = UserManager.sharedManager.useMetricUnits()
-        let isMetric: Bool = true
-
+    public func unitForSystem(metric: Bool) -> HKUnit? {
         switch identifier {
         case HKCategoryTypeIdentifierSleepAnalysis:
             return HKUnit.hourUnit()

            return HKUnit.gramUnitWithMetricPrefix(HKMetricPrefix.Milli)

        case HKQuantityTypeIdentifierDistanceWalkingRunning:
            return isMetric ? HKUnit.meterUnitWithMetricPrefix(HKMetricPrefix.Kilo) : HKUnit.mileUnit()

        case HKQuantityTypeIdentifierElectrodermalActivity:
            return HKUnit.siemenUnitWithMetricPrefix(HKMetricPrefix.Micro)

    public var defaultUnit: HKUnit? { return quantityType.defaultUnit }

    public var hkType: HKSampleType? { return quantityType }

    public func unitForSystem(metric: Bool) -> HKUnit? {
        return quantityType.unitForSystem(metric: metric)
    }
}

/*
