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


class MLImageClassifierBuilder


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.

Describing a Builder

var playgroundDescription: Any

A description of the image classifier builder shown in a playground.