Repository navigation
Forward scale parameter in WebImage convenience initializers - #368
shubhransh-gupta wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The supplied scale is preserved in both initializer forms, with a test covering each path; no material merge risk was identified. Pre-merge checks |
|
CI Status NoteJust adding a note regarding the Unit Test CI failures across iOS, macOS, and tvOS: The failure is unrelated to the changes in this PR and is caused by an external outage in the existing test suite:
All other checks — Cocoapods Lint, Run Demo, Build Library, and the newly added I noticed #367 is already open addressing this dead URL. Once that is merged, I will gladly rebase this PR immediately for a fully green CI run. Alternatively, if the maintainers prefer, I can also raise a separate PR or include the test URL update here. |
Summary
Fixes #362
In
WebImage.swift, the convenience initializers:init(url:scale:options:context:isAnimating:)init(url:scale:options:context:isAnimating:content:placeholder:)both accepted the
scale: CGFloat = 1parameter, but delegated toself.init(url: options: context: isAnimating:)without passingscale: scale. Because the designated initializer defaultsscaleto1, the custom scale parameter passed by callers was silently ignored and always set to1incontext[.imageScaleFactor].This PR forwards
scale: scalein both convenience initializers and adds a unit test verifyingimageScaleFactorreceives the expected scale factor.Testing
testWebImageScaleParameterunit test verifying both convenience initializers preserve custom scale values (scale = 2andscale = 3).xcodebuild -workspace SDWebImageSwiftUI.xcworkspace -scheme 'SDWebImageSwiftUITests macOS' -only-testing 'SDWebImageSwiftUITests macOS/WebImageTests/testWebImageScaleParameter' test(TEST SUCCEEDED).Summary by CodeRabbit