mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
28 lines
518 B
Swift
28 lines
518 B
Swift
//
|
|
// Measurement.swift
|
|
// Meshtastic
|
|
//
|
|
// Copyright(c) Garth Vander Houwen 11/17/23.
|
|
//
|
|
|
|
import Foundation
|
|
import Charts
|
|
|
|
struct PlottableMeasurement<UnitType: Unit> {
|
|
var measurement: Measurement<UnitType>
|
|
}
|
|
|
|
extension PlottableMeasurement: Plottable where UnitType == UnitLength {
|
|
var primitivePlottable: Double {
|
|
self.measurement.converted(to: .meters).value
|
|
}
|
|
|
|
init?(primitivePlottable: Double) {
|
|
self.init(
|
|
measurement: Measurement(
|
|
value: primitivePlottable,
|
|
unit: .meters
|
|
)
|
|
)
|
|
}
|
|
}
|