Protocol

MLDataValueConvertible

A type that can be converted to and from a value in a data table.

Overview

A data table may contain an instance of any type that can be represented as an MLDataValue. The Array and Dictionary structures already conform to the MLDataValueConvertible protocol, but you can adopt this protocol in your own code as well.

When you create a data table from a dictionary of columns, you can use any data value-convertible type. The init(dictionary:) initializer in MLDataTable automatically converts the column values you provide into data values.

Topics

Converting a Data Value to an Instance of a Type

init()

Creates a new default value representing a missing or invalid value.

Required.

init?(from: MLDataValue)

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

Required.

Converting an Instance of a Type to a Data Value

var dataValue: MLDataValue

A data value representation of an instance of the conforming type.

Required.

static var dataValueType: MLDataValue.ValueType

The kind of data value to which the conforming type may be converted.

Required.

Relationships

Adopted By