<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/AsyncImage/init(url:scale:content:placeholder:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI10AsyncImageV3url5scale7content11placeholderACyAA19_ConditionalContentVyqd__qd_0_GG10Foundation3URLVSg_04CoreK07CGFloatVqd__AA0D0Vcqd_0_yctcAJRszAA4ViewRd__AaURd_0_r0_lufc"
  },
  "title" : "init(url:scale:content:placeholder:)"
}
-->

# init(url:scale:content:placeholder:)

Loads and displays a modifiable image from the specified URL using
a custom placeholder until the image loads.

```
@export(implementation) nonisolated init<I, P>(url: URL?, scale: CGFloat = 1, @ContentBuilder content: @escaping (Image) -> I, @ContentBuilder placeholder: @escaping () -> P) where Content == _ConditionalContent<I, P>, I : View, P : View
```

## Parameters

`url`

The URL 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.

`content`

A closure that takes the loaded image as an input, and
returns the view to show. You can return the image directly, or
modify it as needed before returning it.

`placeholder`

A closure that returns the view to show until the
load operation completes successfully.

## Discussion

Until the image loads, SwiftUI displays the placeholder view that
you specify. When the load operation completes successfully, SwiftUI
updates the view to show content that you specify, which you
create using the loaded image. For example, you can show a green
placeholder, followed by a tiled version of the loaded image:

```
AsyncImage(url: URL(string: "https://example.com/icon.png")) { image in
    image.resizable(resizingMode: .tile)
} placeholder: {
    Color.green
}
```

If the load operation fails, SwiftUI continues to display the
placeholder. To be able to display a different view on a load error,
use the [`init(url:scale:transaction:content:)`](/documentation/SwiftUI/AsyncImage/init(url:scale:transaction:content:)) initializer instead.

---

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)