Skip to content

Commit 2bfa069

Browse files
chore: format
1 parent 173f8a7 commit 2bfa069

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

Sources/Units/Registry.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/// UnitRegistry defines a structure that contains all defined units. This ensures
22
/// that we are able to parse to and from unit symbol representations.
3-
internal class Registry {
3+
class Registry {
44
// TODO: Should we eliminate this singleton and make clients keep track?
5-
internal static let instance = Registry()
5+
static let instance = Registry()
66

77
// Quick access based on symbol
88
private var symbolMap: [String: DefinedUnit]
@@ -29,7 +29,7 @@ internal class Registry {
2929

3030
/// Returns a list of defined units and their exponents, given a composite unit symbol. It is expected that the caller has
3131
/// verified that this is a composite unit.
32-
internal func compositeUnitsFromSymbol(symbol: String) throws -> [DefinedUnit: Int] {
32+
func compositeUnitsFromSymbol(symbol: String) throws -> [DefinedUnit: Int] {
3333
let symbolsAndExponents = try deserializeSymbolicEquation(symbol)
3434

3535
var compositeUnits = [DefinedUnit: Int]()
@@ -45,7 +45,7 @@ internal class Registry {
4545

4646
/// Returns a defined unit given a defined unit symbol. It is expected that the caller has
4747
/// verified that this is not a composite unit.
48-
internal func getUnit(bySymbol symbol: String) throws -> DefinedUnit {
48+
func getUnit(bySymbol symbol: String) throws -> DefinedUnit {
4949
guard let definedUnit = symbolMap[symbol] else {
5050
throw UnitError.unitNotFound(message: "Symbol '\(symbol)' not recognized")
5151
}
@@ -54,7 +54,7 @@ internal class Registry {
5454

5555
/// Returns a defined unit given a defined unit name. It is expected that the caller has
5656
/// verified that this is not a composite unit.
57-
internal func getUnit(byName name: String) throws -> DefinedUnit {
57+
func getUnit(byName name: String) throws -> DefinedUnit {
5858
guard let definedUnit = nameMap[name] else {
5959
throw UnitError.unitNotFound(message: "Name '\(name)' not recognized")
6060
}
@@ -67,7 +67,7 @@ internal class Registry {
6767
/// - parameter dimension: The unit dimensionality as a dictionary of quantities and their respective exponents.
6868
/// - parameter coefficient: The value to multiply a base unit of this dimension when converting it to this unit. For base units, this is 1.
6969
/// - parameter constant: The value to add to a base unit when converting it to this unit. This is added after the coefficient is multiplied according to order-of-operations.
70-
internal func addUnit(
70+
func addUnit(
7171
name: String,
7272
symbol: String,
7373
dimension: [Quantity: Int],
@@ -95,7 +95,7 @@ internal class Registry {
9595
}
9696

9797
/// Returns all units currently defined by the registry
98-
internal func allUnits() -> [Unit] {
98+
func allUnits() -> [Unit] {
9999
var allUnits = [Unit]()
100100
for (_, unit) in symbolMap {
101101
allUnits.append(Unit(definedBy: unit))

Sources/Units/Unit/Unit.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ public struct Unit {
4848

4949
/// Create a unit from the defined unit object.
5050
/// - Parameter definedBy: A defined unit to wrap
51-
internal init(definedBy: DefinedUnit) {
51+
init(definedBy: DefinedUnit) {
5252
type = .defined(definedBy)
5353
}
5454

5555
/// Create a new from the sub-unit dictionary.
5656
/// - Parameter subUnits: A dictionary of defined units and exponents. If this dictionary has only a single unit with an exponent of one,
5757
/// we return that defined unit directly.
58-
internal init(composedOf subUnits: [DefinedUnit: Int]) {
58+
init(composedOf subUnits: [DefinedUnit: Int]) {
5959
if subUnits.count == 1, let subUnit = subUnits.first, subUnit.value == 1 {
6060
type = .defined(subUnit.key)
6161
} else {

Tests/UnitsTests/XCTest+Measurement.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Units
2+
23
// import Foundation
34
import XCTest
45

0 commit comments

Comments
 (0)