<!--
{
  "availability" : [
    "iOS: 2.0.0 - 9.0.0",
    "iPadOS: 2.0.0 - 9.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.5.0 - 10.11.0",
    "tvOS: 9.0.0 - 9.0.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSURLConnection/init(request:delegate:startImmediately:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLConnection(im)initWithRequest:delegate:startImmediately:"
  },
  "title" : "init(request:delegate:startImmediately:)"
}
-->

# init(request:delegate:startImmediately:)

Returns an initialized URL connection and begins to load the data for the URL request, if specified.

```
init?(request: URLRequest, delegate: Any?, startImmediately: Bool)
```

## Parameters

`request`

The URL request to load. The `request` object is deep-copied as part of the initialization process. Changes made to `request` after this method returns do not affect the request that is used for the loading process.

`delegate`

The delegate object for the connection. The connection calls methods on this delegate as the load progresses.

`startImmediately`

<doc://com.apple.documentation/documentation/Swift/true> if the connection should begin loading data immediately, otherwise <doc://com.apple.documentation/documentation/Swift/false>. If you pass <doc://com.apple.documentation/documentation/Swift/false>, the connection is not scheduled with a run loop. You can then schedule the connection in the run loop and mode of your choice by calling [`schedule(in:forMode:)`](/documentation/Foundation/NSURLConnection/schedule(in:forMode:)).

## Return Value

The URL connection for the URL request. Returns `nil` if a connection can’t be initialized.

## Discussion

During the download the connection maintains a strong reference to the `delegate`. It releases that strong reference when the connection finishes loading, fails, or is canceled.

---

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)