<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreML",
  "identifier" : "/documentation/CoreML/MLTask",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core ML"
    ],
    "preciseIdentifier" : "c:objc(cs)MLTask"
  },
  "title" : "MLTask"
}
-->

# MLTask

An abstract base class for machine learning tasks.

```
class MLTask
```

## Overview

You don’t create use this class directly. Instead, use a class that inherits from this one, such as [`MLUpdateTask`](/documentation/CoreML/MLUpdateTask).

## Topics

### Identifying a task

[`taskIdentifier`](/documentation/CoreML/MLTask/taskIdentifier)

A unique name of the task to distinguish it from all other tasks at runtime.

### Starting and stopping a task

[`resume()`](/documentation/CoreML/MLTask/resume())

Begins or resumes a machine learning task.

[`cancel()`](/documentation/CoreML/MLTask/cancel())

Cancels a machine learning task before it completes.

### Checking the state of a task

[`state`](/documentation/CoreML/MLTask/state)

The current state of the machine learning task.

[`MLTaskState`](/documentation/CoreML/MLTaskState)

The state of a machine learning task.

[`error`](/documentation/CoreML/MLTask/error)

The underlying error if the task is in a failed state.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)