Use the Core ML API directly to support custom workflows and advanced use cases.


In most cases, you interact only with your model's dynamically generated interface, which is created by Xcode automatically when you add a model to your Xcode project. You can use Core ML APIs directly in cases where you need to support custom workflows or advanced use cases. As an example, if you need to make predictions while asynchronously collecting input data into a custom structure, you can use that structure to provide input features to your model by adopting the MLFeatureProvider protocol.



class MLModel

An encapsulation of all the details of your machine learning model.

Model Features

protocol MLFeatureProvider

An interface that represents a collection of feature values for a model.

class MLDictionaryFeatureProvider

A convenience wrapper for the given dictionary of data.

class MLFeatureValue

An immutable instance representing a feature's type and value.

class MLFeatureDescription

A description of a feature.

class MLMultiArray

A multidimensional array used as input or output for a model.

Model Layers

protocol MLCustomLayer

An interface that defines the behavior of a custom layer in your neural network model.



struct MLModelError

Error codes for Core ML.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software