StringMeasurement
@available(swift 3.1)
@available(iOS 10.0, tvOS 10.0, watchOS 3.0, OSX 10.12, *)
public struct StringMeasurement<UnitType> : Equatable where UnitType : Unit
A StringMeasurement is a model type that holds a String value associated with a Unit.
-
The unit component of the
StringMeasurement.Declaration
Swift
private(set) public var unit: UnitType -
The value component of the
StringMeasurement.Declaration
Swift
public var value: String -
Create a
StringMeasurementgiven a specified value and unit.Declaration
Swift
public init(value: String, unit: UnitType) -
The hash value.
Hash values are not guaranteed to be equal across different executions of your program. Do not save hash values to use during a future execution.
Declaration
Swift
public var hashValue: Int { get }
-
Declaration
Swift
public var description: String { get } -
Declaration
Swift
public var debugDescription: String { get } -
Declaration
Swift
public var customMirror: Mirror { get }
-
Compare two measurements of the same
Dimension.If
lhs.unit == rhs.unit, returnslhs.value == rhs.value. Otherwise, convertsrhsto the same unit aslhsand then compares the resulting values.Declaration
Swift
public static func == <LeftHandSideType, RightHandSideType>(lhs: StringMeasurement<LeftHandSideType>, rhs: StringMeasurement<RightHandSideType>) -> Bool where LeftHandSideType : Unit, RightHandSideType : UnitReturn Value
trueif the measurements are equal.
-
Undocumented
Declaration
Swift
public init(from decoder: Decoder) throws -
Encodes this value into the given encoder.
If the value fails to encode anything,
encoderwill encode an empty keyed container in its place.This function throws an error if any values are invalid for the given encoder’s format.
Declaration
Swift
public func encode(to encoder: Encoder) throwsParameters
encoderThe encoder to write data to.