<!--
{
  "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/AsyncImagePhase",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI15AsyncImagePhaseO"
  },
  "title" : "AsyncImagePhase"
}
-->

# AsyncImagePhase

The current phase of the asynchronous image loading operation.

```
enum AsyncImagePhase
```

## Overview

When you create an [`AsyncImage`](/documentation/SwiftUI/AsyncImage) instance with the
[`init(url:scale:transaction:content:)`](/documentation/SwiftUI/AsyncImage/init(url:scale:transaction:content:)) initializer, you define
the appearance of the view using a `content` closure. SwiftUI calls the
closure with a phase value at different points during the load operation
to indicate the current state. Use the phase to decide what to draw.
For example, you can draw the loaded image if it exists, a view that
indicates an error, or a placeholder:

```
AsyncImage(url: URL(string: "https://example.com/icon.png")) { 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.
    }
}
```

## Topics

### Getting load phases

[`AsyncImagePhase.empty`](/documentation/SwiftUI/AsyncImagePhase/empty)

No image is loaded.

[`AsyncImagePhase.success(_:)`](/documentation/SwiftUI/AsyncImagePhase/success(_:))

An image successfully loaded.

[`AsyncImagePhase.failure(_:)`](/documentation/SwiftUI/AsyncImagePhase/failure(_:))

An image failed to load with an error.

### Getting the image

[`image`](/documentation/SwiftUI/AsyncImagePhase/image)

The loaded image, if any.

### Getting the error

[`error`](/documentation/SwiftUI/AsyncImagePhase/error)

The error that occurred when attempting to load an image, if any.



---

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)
