<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/AsyncImage/init(request:scale:transaction:content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI10AsyncImageV7request5scale11transaction7contentACyxG10Foundation10URLRequestVSg_04CoreI07CGFloatVAA11TransactionVxAA0cD5PhaseOctcfc"
  },
  "title" : "init(request:scale:transaction:content:)"
}
-->

# init(request:scale:transaction:content:)

Loads and displays a modifiable image from the specified URL load
request in phases.

```
nonisolated init(request: URLRequest?, scale: CGFloat = 1, transaction: Transaction = Transaction(), @ContentBuilder content: @escaping (AsyncImagePhase) -> Content)
```

## Parameters

`request`

The
<doc://com.apple.documentation/documentation/Foundation/URLRequest>
of the image to display.

`scale`

The scale to use for the image. The default is `1`. Set a
different value when loading images designed for higher resolution
displays. For example, set a value of `2` for an image that you
would name with the `@2x` suffix if stored in a file on disk.

`transaction`

The transaction to use when the phase changes.

`content`

A closure that takes the load phase as an input, and
returns the view to display for the specified phase.

## Discussion

If you set the asynchronous image’s
<doc://com.apple.documentation/documentation/Foundation/URLRequest>
to `nil`, or after you
set the request to a value but before the load operation completes, the
phase is [`AsyncImagePhase.empty`](/documentation/SwiftUI/AsyncImagePhase/empty). After the operation completes, the
phase becomes either [`AsyncImagePhase.failure(_:)`](/documentation/SwiftUI/AsyncImagePhase/failure(_:)) or
[`AsyncImagePhase.success(_:)`](/documentation/SwiftUI/AsyncImagePhase/success(_:)). In the first case, the phase’s
[`error`](/documentation/SwiftUI/AsyncImagePhase/error) value indicates the reason for failure.
In the second case, the phase’s [`image`](/documentation/SwiftUI/AsyncImagePhase/image) property
contains the loaded image. Use the phase to drive the output of the
`content` closure, which defines the view’s appearance:

```
AsyncImage(request: URLRequest(url: imageURL)) { phase in
    if let image = phase.image {
        image // Displays the loaded image.
    } else if phase.error != nil {
        Color.red // Indicates an error.
    } else {
        Color.blue // Acts as a placeholder.
    }
}
```

To add transitions when you change the
<doc://com.apple.documentation/documentation/Foundation/URLRequest>,
apply an identifier to the [`AsyncImage`](/documentation/SwiftUI/AsyncImage).

You can specify the cache policy and timeout interval via `request`.

---

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)