Prefer scaledToFit over a constant-content-mode aspectRatio - #21
Merged
Conversation
SwiftLint's shared configuration enables legacy_swiftui_aspect_ratio, which turns `aspectRatio(contentMode:)` with a literal content mode into an error. The rule became active in the linter version CI installs today, so main went red on five call sites nobody had touched — every one of them an Image that resizes and then fits. `scaledToFit()` is that call spelled the way SwiftUI now wants it, and it is the same modifier underneath, so the five views render identically. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EdB27epdLAZ1x23zkSJ8LT
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.
SwiftLint’s shared configuration enables
legacy_swiftui_aspect_ratio, which treatsaspectRatio(contentMode:)with a literal content mode as an error. The rule became active in the linter version CI installs sometime today: everyRun SwiftLintjob through 22:08 passed, including onmain, and the first job after that failed.So
mainis currently red, on five call sites no open PR has touched. This unblocks all four of the in-flight branches (#17–#20), whose own green SwiftLint results predate the change and would fail if re-run.Each site is an
Imagethat calls.resizable()and then fits;scaledToFit()is the same modifier underneath, so the five views render identically.SF50 TOLD/Views/WelcomeView.swift:32SF50 TOLD/Views/Loading/LoadingConsentView.swift:19SF50 TOLD/Views/Loading/LoadingProgressView.swift:43SF50 TOLD/Views/Overlays/ErrorSheet.swift:12SF50 TOLD/Views/Pickers/AirportPicker/Location/LocationErrorView.swift:11Verified:
swiftlint --strictclean across the whole repo (was 5 serious violations),swift-format lint --strictclean, and the app builds for the iPhone 17 Pro simulator.🤖 Generated with Claude Code
https://claude.ai/code/session_01EdB27epdLAZ1x23zkSJ8LT