---
title: "stopDiscovery(session:)"
framework: DeviceDiscoveryExtension
role: symbol
role_heading: Instance Method
platforms: [iOS 16.0+, iPadOS 16.0+, macOS 13.0+]
path: "devicediscoveryextension/dddiscoveryextension/stopdiscovery(session:)"
---

# stopDiscovery(session:)

Ends the extension’s device discovery process.

## Declaration

```swift
func stopDiscovery(session: DDDiscoverySession)
```

## Parameters

- `session`: An object that reports discovery events.

## Discussion

Discussion The system controls the discovery process using this function by calling it when AVRoutePickerView dismisses. Your extension’s implementation performs any cleanup necessary, such as stopping Bluetooth or Bonjour scanning.

## See Also

### Controlling discovery

- [startDiscovery(session:)](devicediscoveryextension/dddiscoveryextension/startdiscovery(session:).md)
