[UI] Preserve SwiftUI sizing and replacement transitions - #92
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
https://github.com/NachoSoto/AsyncImageView/blob/6e01b2ec20c14b6488d2d006037bb69b154432f1/AsyncSwiftUIImageView.swift#L152
Add an actual stretch-to-fill mode
When .fill is selected for a non-square image in a differently shaped frame, aspectRatio(nil, contentMode: .fill) preserves the image's aspect ratio; it is SwiftUI's aspect-fill behavior and cannot reproduce stretch-to-bounds/UIImageView.ContentMode.scaleToFill. The image will instead extend beyond one frame dimension and either bleed or be cropped, so the legacy scale-to-fill use case described by this change still needs a distinct mode that omits the aspect-ratio modifier.
https://github.com/NachoSoto/AsyncImageView/blob/6e01b2ec20c14b6488d2d006037bb69b154432f1/AsyncSwiftUIImageView.swift#L153-L154
Base replacement animation on the incoming result
When a non-cache-hit image is currently displayed and the next result is a cache hit, changing the ID removes the old subtree using that old subtree's .easeOut transition; the incoming view's animation(nil) does not cancel the outgoing transition. The replacement can therefore still cross-fade or linger despite cache hits being intended to swap immediately, unlike AsyncImageView.updateImage; drive the whole replacement transaction from the incoming result or otherwise disable the outgoing animation for cached replacements.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
Motivation
WatchChess tournament cells need the legacy
scaleToFillpresentation without falling back to aUIViewRepresentable. The existing SwiftUI implementation also attached a transition without changing view identity, so replacing a placeholder with the final image did not actually insert a transitioning view.Validation