diff --git a/Sources/Units/Units.swift b/Sources/Units/Units.swift index 077bf6f..ca3a83d 100644 --- a/Sources/Units/Units.swift +++ b/Sources/Units/Units.swift @@ -329,8 +329,8 @@ public struct UnitValue: -> Bool { // For equality, convert both to base unit for comparison - guard let lhsBase = lhs.converted(to: lhs.unit.category.baseUnit()), - let rhsBase = rhs.converted(to: rhs.unit.category.baseUnit()) + guard let lhsBase = lhs.converted(to: lhs.unit.category.baseUnit), + let rhsBase = rhs.converted(to: rhs.unit.category.baseUnit) else { return false // Or handle error appropriately } @@ -345,8 +345,8 @@ public struct UnitValue: "Cannot compare UnitValues of different categories (\(lhs.unit.category) vs \(rhs.unit.category))" ) } - guard let lhsBase = lhs.converted(to: lhs.unit.category.baseUnit()), - let rhsBase = rhs.converted(to: rhs.unit.category.baseUnit()) + guard let lhsBase = lhs.converted(to: lhs.unit.category.baseUnit), + let rhsBase = rhs.converted(to: rhs.unit.category.baseUnit) else { return false } @@ -464,7 +464,7 @@ public struct UnitValue: // Helper to get the base unit for a category extension UnitCategory { - func baseUnit() -> Unit { + public var baseUnit: Unit { switch self { case .mass: return .gram case .length: return .meter