Enumeration

URLSessionTask.State

Constants for determining the current state of a task.

Declaration

enum State : Int

Topics

Task States

case running

The task is currently being serviced by the session.

case suspended

The task was suspended by the app.

case canceling

The task has received a cancel message.

case completed

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

See Also

Controlling the Task State

func cancel()

Cancels the task.

func resume()

Resumes the task, if it is suspended.

func suspend()

Temporarily suspends a task.

var state: URLSessionTask.State

The current state of the task—active, suspended, in the process of being canceled, or completed.

var priority: Float

The relative priority at which you’d like a host to handle the task, specified as a floating point value between 0.0 (lowest priority) and 1.0 (highest priority).

URL Session Task Priority

Constants for providing task priority hints to a host, used with the priority property.