Protocol

MLDataValueConvertible

A type that can convert itself to and from a data value.

Declaration

protocol MLDataValueConvertible

Overview

You can use any type that conforms to the MLDataValueConvertible protocol in an MLDataValue or an MLDataTable. For example, you can create a data table by using its init(dictionary:) initializer with a [String: MLDataValueConvertible] dictionary.

Topics

Converting from a Data Value to a Type’s Instance

init()

Creates a new default instance of the conforming type when a data value is missing or invalid.

Required.

init?(from: MLDataValue)

Creates an instance of the conforming type from a data value.

Required.

Converting from a Type’s Instance to a Data Value

var dataValue: MLDataValue

The value of the conforming type’s instance wrapped in a data value.

Required.

static var dataValueType: MLDataValue.ValueType

The underlying type the conforming type uses when it wraps itself in a data value.

Required.

Relationships

Conforming Types