---
title: "addSession(_:)"
framework: avsystemrouting
role: symbol
role_heading: Instance Method
path: "avsystemrouting/avsystemroute-5s2um/addsession(_:)"
---

# addSession(_:)

Adds a session to the active route.

## Declaration

```swift
final func addSession(_ session: AVSystemRouteSession) -> Bool
```

## Parameters

- `session`: The session to add to this route. The session must be newly created and not already associated with another route or previously stopped.

## Mentioned in

Routing and streaming media to remote devices

## Return Value

Return Value true if the route successfully adds the session; false if the route cannot add it (for example, if the session is already associated with another route or if the route is in an invalid state).

## Discussion

Discussion Call this function to register a new AVSystemRouteSession with the route before starting playback or communication. The session must be added to the route before calling its start() function. Adding a session establishes the association between the session and this route, enabling the system to manage the session’s lifecycle and route media appropriately. You can add multiple sessions to a single route to handle different media streams or communication channels. Sessions are single-use. Once a session has been stopped, it cannot be added to a route again. Create a new AVSystemRouteSession for each new playback. note: You must remove sessions when they are no longer needed using removeSession(_:) to release system resources.
