Initializerswift 6.0.3Foundation
init(from:)
- iOS
- 10.0+
- macOS
- 10.12+
- tvOS
- 10.0+
- watchOS
- 3.0+
init(from decoder: any Decoder) throws
init(from decoder: any Decoder) throws
where UnitType:Unit
import Foundation
struct Measurement<UnitType> where UnitType : Unit
A Measurement
is a model type that holds a Double
value associated with a Unit
.
protocol Decoder
A type that can decode values from a native format into in-memory representations.
class Unit
var customMirror: Mirror { get }
var debugDescription: String { get }
var description: String { get }
static func * (lhs: Measurement<UnitType>, rhs: Double) -> Measurement<UnitType>
Multiply a measurement by a scalar value.
static func * (lhs: Double, rhs: Measurement<UnitType>) -> Measurement<UnitType>
Multiply a scalar value by a measurement.
static func + (lhs: Measurement<UnitType>, rhs: Measurement<UnitType>) -> Measurement<UnitType>
Add two measurements of the same Unit.
static func - (lhs: Measurement<UnitType>, rhs: Measurement<UnitType>) -> Measurement<UnitType>
Subtract two measurements of the same Unit.
static func / (lhs: Measurement<UnitType>, rhs: Double) -> Measurement<UnitType>
Divide a measurement by a scalar value.
static func / (lhs: Double, rhs: Measurement<UnitType>) -> Measurement<UnitType>
Divide a scalar value by a measurement.
static func < <LeftHandSideType, RightHandSideType>(lhs: Measurement<LeftHandSideType>, rhs: Measurement<RightHandSideType>) -> Bool where LeftHandSideType : Unit, RightHandSideType : Unit
Compare two measurements of the same Unit
.
static func == <LeftHandSideType, RightHandSideType>(lhs: Measurement<LeftHandSideType>, rhs: Measurement<RightHandSideType>) -> Bool where LeftHandSideType : Unit, RightHandSideType : Unit
Compare two measurements of the same Dimension
.
func encode(to encoder: any Encoder) throws