-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature progressiveJPEG for SwiftUI #2366
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @onevcat, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request introduces progressive JPEG support for SwiftUI in Kingfisher. It adds a new ProgressiveJPEGDemo
view to the demo app, showcasing the progressive loading of a JPEG image. The progressiveJPEG
modifier is now available as a KFOptionSetter, and the KingfisherManager is updated to handle progressive image setting during image retrieval. This resolves issue #1554.
Highlights
- Feature: Adds progressive JPEG support to SwiftUI's KFImage, allowing images to load progressively.
- Demo: Introduces a new
ProgressiveJPEGDemo
view in the demo app to demonstrate the progressive JPEG loading feature. - API: The
progressiveJPEG
modifier is now available as a KFOptionSetter, providing a convenient way to enable progressive loading.
Changelog
Click here to see the changelog
- Demo/Demo/Kingfisher-Demo/SwiftUIViews/MainView.swift
- Added a NavigationLink to the new
ProgressiveJPEGDemo
view.
- Added a NavigationLink to the new
- Demo/Demo/Kingfisher-Demo/SwiftUIViews/ProgressiveJPEGDemo.swift
- Created a new SwiftUI view
ProgressiveJPEGDemo
to display a progressive JPEG image usingKFImage
. - Uses
KFImage
with theprogressiveJPEG()
modifier. - Displays the received and total image sizes during loading using the
onProgress
callback.
- Created a new SwiftUI view
- Demo/Kingfisher-Demo.xcodeproj/project.pbxproj
- Added
ProgressiveJPEGDemo.swift
to the project. - Added
ProgressiveJPEGDemo.swift
to the build file. - Added
ProgressiveJPEGDemo.swift
to the sources build phase.
- Added
- Sources/General/KF.swift
- Removed the
progressiveJPEG
function from the KF.Builder extension.
- Removed the
- Sources/General/KFOptionsSetter.swift
- Added the
progressiveJPEG
function to the KFOptionSetter extension, allowing it to be used with SwiftUI.
- Added the
- Sources/General/KingfisherManager.swift
- Modified
retrieveImage
to accept aprogressiveImageSetter
closure. - The
progressiveImageSetter
closure is called when a progressively loaded image is available.
- Modified
- Sources/SwiftUI/ImageBinder.swift
- Added
progressiveImageSetter
to theretrieveImage
call, which updates theloadedImage
property with the progressively loaded image.
- Added
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Trivia time!
What does JPEG stand for?
Click here for the answer
JPEG stands for Joint Photographic Experts Group.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces progressive JPEG support to SwiftUI views in Kingfisher. The changes involve adding a new demo view, modifying the KFImage
and KingfisherManager
to handle progressive images, and updating project files. Overall, the implementation seems reasonable, but there are a few areas that could be improved for clarity and maintainability.
Merge Readiness
The pull request introduces a new feature and seems generally well-implemented. I am unable to directly approve the pull request, and recommend that others review and approve this code before merging. Given the absence of any CRITICAL or HIGH severity issues, the pull request is a good candidate for merging after addressing the MEDIUM and LOW severity issues. I recommend that the pull request not be merged until those are addressed (at a minimum).
This allows SwiftUI uses the progressive JPEG modifier to display an image with progressive support.
Solve #1554
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-03-04.at.01.08.10.mp4