-
Notifications
You must be signed in to change notification settings - Fork 98
Provide / document an API to download images, outside of a SwiftUI context #70
Comments
This! +1 |
This would be awesome! |
Hey, this is not trivial because data logic is tightly coupled with image decoding. But I'm working on next version of the package and it will allow download/use cached images without view part. I hope to share updates soon. |
Thx for the hard work! |
Version 2.0 uses new structure that allows me to implement this feature. I will keep this issue updated. |
You all work is really nice. |
Hey, sure, you can write a helper function like this: https://gist.github.com/dmytro-anokhin/51aaeecb03a4e8249d7783cc5c60cb3b |
Hi Dmytro
And thank you. It is a really nice work you are doing because this feature to manage easily external image is really useful.
I was not able to compile your example because I am not fluent in Result type management. I am not a professional developer.
I have URL Image package in version 2.2.0 and I am getting these errors. It might be because you have a component, that I do not have.
Error messages are :
Result<ImageInfo, Error> -> Cannot specialize non-generic type 'Result'
completion(.success(transientImage.info))-> Type Result has no member success
completion(.failure(error)) -> Type Result has no member failure
If you have time to have a look, would be much appreciated.
… Le 8 janv. 2021 à 21:37, Dmytro Anokhin ***@***.***> a écrit :
Hey, sure, you can write a helper function like this: https://gist.github.com/dmytro-anokhin/51aaeecb03a4e8249d7783cc5c60cb3b <https://gist.github.com/dmytro-anokhin/51aaeecb03a4e8249d7783cc5c60cb3b>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#70 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADY54INSOF265XKROSSUE6LSZABSZANCNFSM4M67YR4A>.
|
Replied in the gist, not to create noise here. |
Hey there, I added
Documentation coming soon. Cheers. |
Hey, I know this issue is long overdue, but I was struggling to come up with a nice API that won't overcomplicate the package. Finally, I think I got there 🙂 In 2.2.1 there is a new publisher added to the package: Here is documentation, and some examples how to use it: https://github.com/dmytro-anokhin/url-image#fetching-an-image Please let me know if there is something else that I miss/you expect. Otherwise I will close this issue soon. Cheers. |
Hi @dmytro-anokhin, the documentation seems to be outdated and the code samples do not work. Could you please update the documentation and the example? For example, URLImageService does not have a I've been able to access the Also, I think it's worth mentioning that the The code also never seems to get to the
Hope you're doing well. Thanks |
Hey @FilipK999, thanks for bringing up. |
I am using URL Image in a Swift UI project, and I would like to reuse the downloading/caching logic of URL Image, but outside a SwiftUI hierarchy.
My specific use case is to create an attachment for a local notification, and it only accepts on-disk file URLs. Since these images are profile pictures and likely to be already in URLImage cache, it makes sense to reuse the cache.
Digging inside the code source, it appears it should be possible by using directly DownloadService, but :
1/ It is not clear if this API is public, or used internally for separting concerns and may be subject to evolution
2/ The API feel a bit low level, for instance it is not clear what fileIdentifier should be by default, or why a separated addHandler/load is necessary, so it maybe interesting to put a facade in URLImageService to make simple calls like :
URLImageService.load(url) { image, err in ... }
A way to get the local file path/URL, maybe as an additional parameter of the above closure, would be very helpful in my case.
The text was updated successfully, but these errors were encountered: