<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLSessionTask/State-swift.enum",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@E@NSURLSessionTaskState"
  },
  "title" : "URLSessionTask.State"
}
-->

# URLSessionTask.State

Constants for determining the current state of a task.

```
enum State
```

## Topics

### Task states

[`NSURLSessionTaskStateRunning`](/documentation/Foundation/URLSessionTask/State-swift.enum/running)

The task is currently being serviced by the session.

[`NSURLSessionTaskStateSuspended`](/documentation/Foundation/URLSessionTask/State-swift.enum/suspended)

The task was suspended by the app.

[`NSURLSessionTaskStateCanceling`](/documentation/Foundation/URLSessionTask/State-swift.enum/canceling)

The task has received a `cancel` message.

[`NSURLSessionTaskStateCompleted`](/documentation/Foundation/URLSessionTask/State-swift.enum/completed)

The task has completed (without being canceled), and the task’s delegate receives no further callbacks.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

[`Sendable`](/documentation/Swift/Sendable)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

---

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)