Skip to content
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

[Question][API Design] Is it ok to use sd_internalSetImageWithURL in my project? #3633

Closed
3 tasks done
Alatip opened this issue Nov 7, 2023 · 8 comments
Closed
3 tasks done

Comments

@Alatip
Copy link

Alatip commented Nov 7, 2023

New Issue Checklist

Issue Info

Info Value
Platform Name ios
Platform Version any
SDWebImage Version 5.13.4
Integration Method spm
Xcode Version Xcode 15.0.1
Repro rate all the time (100%)
Repro with our demo prj -
Demo project link -

Issue Description and Steps

Can I use the UIImage+sd_internalSetImageWithURL method in my project? The completion block's name is SDInternalCompletionBlock. But the API is open and visible from my project (that integrates SDWebImage via SPM). Can I assume the API will stay as is or it could be broken at any moment?

I need the data parameter so I can solve my problem. That's why I want to use the internalSet function.

@Alatip Alatip changed the title [Question][API Design] Is it ok to sd_internalSetImage in my project? [Question][API Design] Is it ok to use sd_internalSetImageWithURL in my project? Nov 7, 2023
@dreampiggy
Copy link
Contributor

The API has exists for 3 years. It still treated as public API and the only break time is v6.0.0

@dreampiggy
Copy link
Contributor

I need the data parameter so I can solve my problem. That's why I want to use the internalSet function.

Maybe or may not. If you want "Do decode in the completion block", pay attention your decoding will block main queue. Because the completion block is always called at main queue.

If you want to dispatch to async, this will break UIKit's render lifecycle, because the setImage does not happended on the same Runloop.

  1. Set image to placeholder1
  2. Load image from memory cache
  3. Decode data in async global queue (!!!!!!) -> Switch to next runloop
  4. Set the decoded image

This cause a refresh and render flashing.

@dreampiggy
Copy link
Contributor

If the case I talked above is your issue. Please, use Custom Coder instead for this.

https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-coder-420

@Alatip
Copy link
Author

Alatip commented Nov 8, 2023

We have some custom optimisations over a network layer, so I need to get data.count and send the value into our framework. I don't do decoding or other things.

@Alatip
Copy link
Author

Alatip commented Nov 8, 2023

The API has exists for 3 years. It still treated as public API and the only break time is v6.0.0

Is there a timeline or schedule for v6.0.0, so we can plan ahead and estimate when to expect a possible API breakage?

@Alatip
Copy link
Author

Alatip commented Nov 8, 2023

@dreampiggy thank you for a quick response!

@dreampiggy
Copy link
Contributor

The API has exists for 3 years. It still treated as public API and the only break time is v6.0.0

Is there a timeline or schedule for v6.0.0, so we can plan ahead and estimate when to expect a possible API breakage?

Seems no real timeline. Because the biggest blocking PR #2980 no body was doing...

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

No branches or pull requests

2 participants