<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLSession/DataTaskPublisher/init(request:session:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So12NSURLSessionC10FoundationE17DataTaskPublisherV7request7sessionAeC10URLRequestV_ABtcfc"
  },
  "title" : "init(request:session:)"
}
-->

# init(request:session:)

Creates a data task publisher from the provided URL request and URL session.

```
init(request: URLRequest, session: URLSession)
```

## Parameters

`request`

The [`URLRequest`](/documentation/Foundation/URLRequest) from which to create a URL session data task.

`session`

The [`URLSession`](/documentation/Foundation/URLSession) to create the data task.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)