Repository navigation
Add an article on replacing AsyncImage with LazyImage - #1095
Merged
Merged
Conversation
Covers the swap for each AsyncImage initializer, where the behavior differs (a missing URL is an error, the error is typed, disappearing cancels the load), the environment pipeline as the counterpart of asyncImageURLSession(_:), and a phase helper for code that takes an AsyncImagePhase. Every sample is compiled by the documentation snippets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1094, because the session example uses
.imagePipeline(_:). Merge #1094 first. If this is merged before it, the branch is merged into a branch that never reachesmain: retarget this PR tomainafter #1094 lands, as GitHub does when that branch is deleted on merge.A new article,
replacing-async-image, for people who haveAsyncImagecode, or an agent that writes it, and wantLazyImage. #1064 has a mapping table for it among the other libraries; this is the longer walkthrough.content:placeholder:forms, and a row for everyAsyncImageinitializer, including the iOS 27request:forms, whichLazyImage(request:)covers from iOS 16.scale, which lives onImageRequestand defaults to1, likeAsyncImage.asyncImageURLSession(_:)→imagePipeline(_:), with aDataLoaderconfiguration that carries headers.nilURL fails withimageRequestMissing, the error isImagePipeline.Error, and disappearing cancels the load.LazyImageState.phaseextension for code that takes anAsyncImagePhase, so a shared helper doesn't have to be rewritten.Linked from the SwiftUI article and the topics list, and added to
ARTICLE_ORDERso the llms files pick it up at the release (checked by running the generator; the generated files are not committed). Every sample is inReplacingAsyncImageSnippets.swift, verbatim, andmake snippetscompiles it.make docsbuilds with no warnings.Left out on purpose
mainyet; that is Show memory cache hits in the first body of LazyImage #1093.AsyncImagedoes for anilURL or an animated image. I didn't verify either, so the article only says whatLazyImagedoes.Overlap with #1064. Its table says
.asyncImageURLSession(_:)maps to.pipeline(_:)on each view, and its "What has no counterpart" section lists the session in the environment. Both are out of date once #1094 lands. They are two lines in a file this PR doesn't touch, so I left them.