Skip to content

Prefer scaledToFit over a constant-content-mode aspectRatio - #21

Merged
RISCfuture merged 1 commit into
mainfrom
told/scaled-to-fit
Sep 3, 2026
Merged

Prefer scaledToFit over a constant-content-mode aspectRatio#21
RISCfuture merged 1 commit into
mainfrom
told/scaled-to-fit

Conversation

@RISCfuture

Copy link
Copy Markdown
Contributor

SwiftLint’s shared configuration enables legacy_swiftui_aspect_ratio, which treats aspectRatio(contentMode:) with a literal content mode as an error. The rule became active in the linter version CI installs sometime today: every Run SwiftLint job through 22:08 passed, including on main, and the first job after that failed.

So main is 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 Image that calls .resizable() and then fits; scaledToFit() is the same modifier underneath, so the five views render identically.

  • SF50 TOLD/Views/WelcomeView.swift:32
  • SF50 TOLD/Views/Loading/LoadingConsentView.swift:19
  • SF50 TOLD/Views/Loading/LoadingProgressView.swift:43
  • SF50 TOLD/Views/Overlays/ErrorSheet.swift:12
  • SF50 TOLD/Views/Pickers/AirportPicker/Location/LocationErrorView.swift:11

Verified: swiftlint --strict clean across the whole repo (was 5 serious violations), swift-format lint --strict clean, and the app builds for the iPhone 17 Pro simulator.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EdB27epdLAZ1x23zkSJ8LT

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
@RISCfuture
RISCfuture merged commit e3a680f into main Sep 3, 2026
8 checks passed
@RISCfuture
RISCfuture deleted the told/scaled-to-fit branch September 3, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant