TomTomSDKCommon+Measurement
extension Measurement
extension Measurement where UnitType: Dimension
-
Returns a decorator that provides additional methods.
Using a decorator is a convenient way of extending
Measurementwhile mitigating the risk of conflicting with extensions from other libraries or Apple. Extending standard structures likeMeasurementwith properties likevar metersis convenient:- it avoids extracting value without explicit conversion to a certain unit
- it simplifies getting a value from an optional
Measurement
Typical use cases for
MeasurementDecoratorare:- extracting value from a value representing a unit of measure:
let optionalDistanceInMeters = distance?.tt.meters - performing computations on values representing units of measure:
cumulativeDistance += anotherDistance.tt - comparing values representing units of measure:
if delay < .tt.seconds(5) {} - combining value extraction and typecast:
let intValue = distance.tt.intValue(in: .meters)
Declaration
Swift
public var tt: MeasurementDecorator<UnitType> { get } -
Returns the type of decorator that provides additional static methods. A decorator is a convenient way of extending
Measurementwhile mitigating the risk of conflicting with extensions from other libraries or Apple.Declaration
Swift
public static var tt: MeasurementDecorator<UnitType>.Type { get }
-
It should not conflict with other libs extensions since the right part is a decorator.
Declaration
Swift
public static func += (left: inout Measurement<UnitType>, right: MeasurementDecorator<UnitType>) -
It should not conflict with other libs extensions since the right part is a decorator.
Declaration
Swift
public static func -= (left: inout Measurement<UnitType>, right: MeasurementDecorator<UnitType>)
TomTom SDK for iOS (0.53.1)
TomTomSDKCommon+Measurement