---
title: "getAllTasks(completionHandler:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/urlsession/getalltasks(completionhandler:)"
---

# getAllTasks(completionHandler:)

Asynchronously calls a completion callback with all tasks in a session

## Declaration

```swift
func getAllTasks(completionHandler: @escaping @Sendable ([URLSessionTask]) -> Void)
```

```swift
var allTasks: [URLSessionTask] { get async }
```

## Parameters

- `completionHandler`: The completion handler to call with the list of tasks.

## See Also

### Managing the session

- [finishTasksAndInvalidate()](foundation/urlsession/finishtasksandinvalidate().md)
- [flush(completionHandler:)](foundation/urlsession/flush(completionhandler:).md)
- [getTasksWithCompletionHandler(_:)](foundation/urlsession/gettaskswithcompletionhandler(_:).md)
- [invalidateAndCancel()](foundation/urlsession/invalidateandcancel().md)
- [reset(completionHandler:)](foundation/urlsession/reset(completionhandler:).md)
- [sessionDescription](foundation/urlsession/sessiondescription.md)
