Skip to content

Remove version guards below the Kingfisher 8 baseline - #2571

Merged
onevcat merged 4 commits into
onevcat:masterfrom
mini-min:cleanup/version-guards-below-floor
Aug 25, 2026
Merged

Remove version guards below the Kingfisher 8 baseline#2571
onevcat merged 4 commits into
onevcat:masterfrom
mini-min:cleanup/version-guards-below-floor

Conversation

@mini-min

Copy link
Copy Markdown
Contributor

Motivation

Kingfisher 8 requires iOS 13.0+ / tvOS 13.0+ / macOS 10.15+ / watchOS 6.0+ / visionOS 1.0+ and Swift 5.9+. Package.swift, Kingfisher.podspec, and the Xcode project all declare the same deployment targets. A few version checks below this baseline are still in the sources. They always take the same branch, so the other branch is dead code.

Changes

  • String+SHA256: the CryptoKit path is always available, so the CommonCrypto fallback and its import are removed. CommonCrypto is not used anywhere else.
  • Indicator: picks the .large / .medium activity indicator styles directly. The UIActivityIndicatorView.Style compatibility extension only declared fallback constants for compilers older than 5.1, so nothing is left in it and the whole extension is removed.
  • AnimatedImageView: reads UITraitCollection.current.displayScale directly instead of falling back to UIScreen.main.scale.
  • KingfisherError.isLowDataModeConstrained and the low data mode request setup in ImageDownloader: only the #available clause is removed, the remaining conditions stay.
  • CPListItem: every SDK that ships with Swift 5.4+ accepts setImage(nil), so the image is set unconditionally.
  • DisplayLink: the swift(>=5.9) guards are removed. The #available(macOS 14.0, *) check stays, since that is a real runtime check.
  • The @available(tvOS 12.0, *) annotations on the TVMonogramView support and the @available(iOS 13.0, tvOS 13.0, *) annotations on the UIAction / UICommand conformances are at or below the baseline and no longer restrict anything, so they are removed as well.

The compiler(>=5.10), swift(>=5.10), and compiler(>=6) guards are left untouched. Their else branches still compile on a Swift 5.9 toolchain.

No behavior change is intended. The diff is deletions and indentation only.

Tests

No new tests. The full suite passes on iOS and macOS locally, and tvOS / watchOS / visionOS still build.

The deployment floor of iOS 13 / tvOS 13 / macOS 10.15 / watchOS 6
makes the CryptoKit branch always available, so the availability check
is always true and the CC_SHA256 path can never run. Delete the
fallback and the CommonCrypto import, which has no other use in the
project.
The deployment floor is iOS 13 / tvOS 13 / macOS 10.15 / watchOS 6,
declared identically in Package.swift, Kingfisher.podspec and the
Xcode project. Availability checks at or below that floor are always
true, and their else branches are unreachable.

Keep the always-true branches and drop the checks:

- Indicator picks the .large / .medium activity indicator styles
  directly instead of falling back to the removed .white / .gray.
- AnimatedImageView reads UITraitCollection.current.displayScale
  directly, and the scale variable becomes a constant.
- KingfisherError.isLowDataModeConstrained and the low data mode
  request setup in ImageDownloader keep their remaining conditions,
  only the availability clause is removed.
The Kingfisher 8.0 requirements in the README state Swift 5.9+, so
compiler(>=5.1), compiler(>=5.4) and swift(>=5.9) are always true and
their else branches never compile.

- The UIActivityIndicatorView.Style compatibility extension only
  declared fallback .large / .medium constants inside the dead else
  branch, so removing the guard leaves it empty and the whole
  extension goes away.
- CPListItem gets its image set unconditionally. The comment
  explaining the removed compile check goes with it.
- DisplayLink keeps the macOS 14.0 availability check and the
  CADisplayLink conformances unguarded, and drops the "make old
  compilers happy" workaround.

The compiler(>=5.10) and swift(>=5.10) guards in Image.swift and
CallbackQueue.swift stay, as do all compiler(>=6) guards: their else
branches still compile under a Swift 5.9 toolchain.
…rgets

The tvOS 12.0 annotations on the TVMonogramView support and the
iOS 13.0 / tvOS 13.0 annotations on the UIAction and UICommand
conformances are at or below the deployment floor, so they no longer
restrict anything.

@onevclaw onevclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed exact head 854c18b9e55d75a26c9dda739ae3429789dac9fa and found no blocking issues. The removed compiler and availability branches are unreachable under Kingfisher 8’s supported Swift and platform minimums, while the macOS runtime fallback remains intact.

Local validation passed the full test suite, CocoaPods lint across supported platforms, SwiftPM build, visionOS build, and a Catalyst 13.1 type-check probe. I’m leaving this as a non-approving review because the visible CI state is still pending.

onevclaw - an assistant to @onevcat

@onevcat

onevcat commented Aug 25, 2026

Copy link
Copy Markdown
Owner

LGTM! Thank you for it.

@onevcat
onevcat merged commit 7f11fb1 into onevcat:master Aug 25, 2026
24 checks passed
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.

3 participants