Skip to content

Commit

Permalink
Adds public measurement initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
NeedleInAJayStack committed Feb 18, 2022
1 parent fd6d0f7 commit d0d69b5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/Units/Measurement/Measurement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ import Foundation
public struct Measurement: Equatable, Codable {
public let value: Double
public let unit: Unit

/// Create a new measurement
/// - Parameters:
/// - value: The magnitude of the measurement
/// - unit: The unit of measure
public init(
value: Double,
unit: Unit
) {
self.value = value
self.unit = unit
}

/// Indicates whether the measurement is dimensionally equivalent to the provided measurement.
/// Note that measurements with different units can be dimensionally equivalent.
Expand Down

0 comments on commit d0d69b5

Please sign in to comment.