Skip to content

Base Telemetry Widget

Cristina Suciu edited this page Dec 23, 2020 · 1 revision

Most of the telemetry widgets that compose the telemetry panel follow the same similar user interface traits. In order to provide ease of implementation, this abstract class has been designed. This behaves as the base class for all the telemetry widgets.

The main layout of the widget is controlled by a horizontal stack view that holds the references to a title label, value label, unit label and image view container. The positioning of the image view container is controlled through updating the telemetry widget type.

The possible values for the telemetry widget type are:

Type Layout Example
Text Horizontal Velocity Widget
TextImageLeft Location Widget
TextImageRight Vertical Velocity Widget

Customizations

The UI elements can be customized to match the style of the user's application. The customizations can be done using the public API designed in this widget.

Text Customizations

List of customization APIs
  • var normalValueColor: UIColor - The text color of the value in a normal state, by default white.
  • var errorValueColor: UIColor - The text color of the value in an error state, by default red.
  • var topMargin: CGFloat - The topMargin for insetting the content, by default 5p.
  • var bottomMargin: CGFloat - The bottomMargin for insetting the content, by default 5p.
  • var leftMargin: CGFloat - The leftMargin for insetting the content, by default 5p.
  • var rightMargin: CGFloat - The rightMargin for insetting the content, by default 5p.
  • var spacing: CGFloat - The space between the elements, by default 2p.
  • var type: BaseTelemetryType - The type of the layout, by default TextImageLeft.
  • var labelText: String - The string value of the label.
  • var labelFont: UIFont - The font of the label.
  • var labelTextColor: UIColor - The text color of the label.
  • var labelBackgroundColor: UIColor - The background color of the label.
  • var labelVisibility: Bool - The visibility of the label.
  • var valueText: String - The string value of the value.
  • var valueAlignment: NSTextAlignment - The alignment of the value, center by default.
  • var valueFont: UIFont - The font of the value.
  • var valueTextColor: UIColor - The text color of the value.
  • var valueBackgroundColor: UIColor - The background color of the value.
  • var valueVisibility: Bool - The visibility of the value.
  • var unitText: String - The string value of the unit.
  • var unitFont: UIFont - The font of the unit.
  • var unitTextColor: UIColor - The text color of the unit.
  • var unitBackgroundColor: UIColor - The background color of the unit.
  • var unitVisibility: Bool - The visibility of the unit.
  • var backgroundColor: UIColor - The background color of the widget.

Icon Customizations

List of customization APIs
  • var image: UIImage - The image of the icon.
  • var imageTintColor: UIColor - The tint color of the icon.
  • var imageBackgroundColor: UIColor - The background color of the icon.
  • var imageVisibility: Bool- The visibility of the icon.
Clone this wiki locally