Skip to content

Fix MainActor violation in KingfisherSource, update minimum deployment to iOS 13, and update external dependencies#443

Open
Caplord wants to merge 17 commits into
zvonicek:masterfrom
Caplord:fix/mainactor-kingfisher
Open

Fix MainActor violation in KingfisherSource, update minimum deployment to iOS 13, and update external dependencies#443
Caplord wants to merge 17 commits into
zvonicek:masterfrom
Caplord:fix/mainactor-kingfisher

Conversation

@Caplord

@Caplord Caplord commented Apr 29, 2025

Copy link
Copy Markdown

Summary:
This PR fixes a concurrency violation in KingfisherSource.load(to:with:), where setImage(with:) must be called from a @mainactor context.
In addition, it updates:
The minimum deployment target to iOS 13 to align with Swift Concurrency requirements and modern platform standards.
Several external library dependencies to their latest stable versions.
Changes:
✅ Wrap kf.setImage call inside Task { @mainactor in ... } to ensure correct thread access.
✅ Update iOS minimum deployment target to iOS 13.
✅ Update external libraries:
AFNetworking from 3.2.1 ➔ 3.2.1 (no update needed — latest available is 4.0.1, but 3.x seems intentional for Objective-C compatibility)
Alamofire from 5.2.1 ➔ 5.10.2
AlamofireImage from 4.1.0 ➔ 4.3.0
Kingfisher from 5.14.0 ➔ 8.3.2
SDWebImage from 5.8.1 ➔ 5.21.0
Why:
Concurrency compliance: Future-proofs the codebase against Swift concurrency runtime errors.
Platform alignment: iOS 13 introduced critical modern APIs such as Combine and initial concurrency support.
Dependency maintenance: Ensures compatibility with newer Swift and Xcode versions, security fixes, and performance improvements.
Impact:
Apps using this library must now target iOS 13 or later.
Updated dependencies could introduce minor behavior changes; no major breaking change expected based on release notes.
Notes:
Happy to adjust this PR based on feedback! 🙏

@Caplord

Caplord commented Apr 29, 2025

Copy link
Copy Markdown
Author

@zvonicek can you check my PR please ?

Caplord and others added 13 commits June 12, 2026 00:52
Remove the Swift 4.2 typealias shims (SwiftSupport.swift), #available
guards for iOS 11/13, and legacy API spellings now that the minimum
deployment target guarantees them. Set isModalInPresentation directly
instead of via KVC. In the zoom transition, look up the key window via
connectedScenes and remove the dismiss gesture recognizer from the
window it was actually added to rather than re-querying the key window.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mark InputSource/ActivityIndicator/PageIndicator conformers
@preconcurrency with @MainActor-isolated methods. In KingfisherSource,
run load/cancel synchronously on the main actor instead of deferring
through Task (the deferred cancel could race a newly started load), and
report failures with a nil image so ImageSlideshowItem enables the
retry gesture again. Bundle.module becomes an immutable static let.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Apply the project migration (objectVersion 54, module verifier, script
sandboxing, scheme updates) and raise the example deployment target.
Release keeps full optimization (-O with whole-module compilation).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Raise the platform floor to iOS 15 in the podspec, Podfile and
Package.swift (which requires swift-tools 5.5). Fix the SPM
AlamofireImage requirement that pointed at a nonexistent 5.10.2
release, breaking dependency resolution. Keep the Alamofire3 subspec
on AlamofireImage 3.x to match its legacy source, align the Kingfisher
constraint with SPM (>= 8.3.2), and drop stale subspec platform
overrides and a duplicated swift_versions entry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Give AFURLSource the same treatment as the other input sources:
@preconcurrency conformance with a @MainActor-isolated load/cancel,
which also fixes the strict-concurrency 'sending non-Sendable closure'
errors. Failures now report a nil image, consistent with the other
sources, so the retry gesture is enabled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AFNetworking's #import <netinet6/in6.h> now hits a private modular
header, so disable clang modules for that pod and link its system
frameworks explicitly via a post_install hook. Turn off user script
sandboxing, which blocks the CocoaPods embed-frameworks phase.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Delete SwiftSupport.swift (empty since the Swift 4.2 shims were
removed) and the Parse subspec with its source, which pinned Parse
~> 1.14 from 2016 and no longer builds. Unify the example project on
SWIFT_VERSION 5.0 and deployment target 15.0 to match the Podfile.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AFNetworking is deprecated upstream and needed a build workaround on
current SDKs; the example keeps demonstrating remote loading through
AlamofireSource, SDWebImageSource and KingfisherSource. Integrate the
test target with CocoaPods so tests can import the framework.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cover the circular paging math (dummy edge pages, wrap-around,
non-circular bounds), PageIndicatorPosition frame and padding
computation, and the input-source callback contract including the
failed-load retry behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add Example/project.yml as the source of truth for the Xcode project.
The generated ImageSlideshow.xcodeproj/ is gitignored (inverse
convention): CI installs XcodeGen and runs `xcodegen generate` before
`pod install`, and contributors do the same locally.

The generated project also fixes a legacy quirk where
PageIndicatorPosition.swift was compiled directly into the app and test
targets in addition to the framework.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The framework target produced ImageSlideshow.framework with only Core
sources, which shadowed the CocoaPods pod (that also includes the
input sources) via xcodebuild implicit dependency resolution. The
example app gets the framework from CocoaPods; the standalone target
was a legacy artefact and is not needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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