iPhone SwiftUI layouts
Explore SwiftUI APIs, components, and modifiers with interactive iPhone previews, Swift code, and Apple documentation. Compare every available orientation, appearance, and design.
201elements
AsyncImage
Custom Session Async URL Image
A modifier that adds a URL session for asynchronous images contained in the view to use when fetching image data.
Explore Custom Session Async URL Image on iPhone in portrait, with SwiftUI code and Apple API documentation.
SwiftUI code
let imageURL = URL(string: "https://exploreswiftui.com/images/cats.jpg")!
let imageSession: URLSession = {
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = [
"X-Custom-Header": "CustomValue"
]
return URLSession(configuration: configuration)
}()
var body: some View {
AsyncImage(request: URLRequest(url: imageURL)) { image in
image
} placeholder: {
ProgressView()
}
.asyncImageURLSession(imageSession)
}Compatibility
iOS 27.0+ iPadOS 27.0+ macOS 27.0+ watchOS 27.0+ tvOS 27.0+ visionOS 27.0+
Tags
Found an issue or have a suggestion?
All variants
Every available iPhone screenshot for Custom Session Async URL Image.