---
title: "urlSession(matching:)"
framework: swiftui
role: symbol
role_heading: Type Method
path: "swiftui/backgroundtask/urlsession(matching:)"
---

# urlSession(matching:)

A task that responds to background URL sessions matching the given predicate.

## Declaration

```swift
static func urlSession(matching: @escaping @Sendable (String) -> Bool) -> BackgroundTask<String, Void>
```

## Parameters

- `matching`: The predicate to match.

## Return Value

Return Value A background task that you can handle with your app or extension.

## See Also

### Responding to URL sessions

- [urlSession](swiftui/backgroundtask/urlsession.md)
- [urlSession(_:)](swiftui/backgroundtask/urlsession(_:).md)
