An Xcode playground UI that you use to train a model to classify images.


An image classifier is a machine learning model that takes an image as its input and makes a prediction about what the image represents. Use an image classifier builder in an Xcode playground with a macOS target to train an image classifier to make predictions.

When you create a builder, you show it in a live view:

import CreateMLUI

let builder = MLImageClassifierBuilder()

After that, you interact with the builder entirely through the UI of the live view that appears in Xcode’s assistant editor. Use the configuration options that the builder gives you to control training parameters like the number of iterations and augmentation settings. Begin training the model by dragging your training data into the classifier. After training finishes, you also use the UI to test your model, and then save it to a file for use in a Core ML app.

Screenshot showing the image classifier training parameters, including maximum iteration count and augmentation options.


Creating an Image Classifier Builder


Creates an image classifier builder that you can use in a macOS playground.

Displaying a Builder

func showInLiveView() -> String

Shows the image classifier builder in the assistant editor in a macOS playground.

var liveView: NSView

The live view in which the image classifier builder appears.

Inspecting a Builder

var playgroundDescription: Any

A description of the classifier shown in a playground.


See Also

Computer Vision

Creating an Image Classifier Model

Train a machine learning model to classify images.

struct MLImageClassifier

A model you train to classify images programmatically.


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