dmytro-anokhin / url-image

AsyncImage before iOS 15. Lightweight, pure SwiftUI Image view, that displays an image downloaded from URL, with auxiliary views and local cache.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Roadmap to 3.0 πŸš€

dmytro-anokhin opened this issue Β· comments

Roadmap to 3.0 πŸš€

Today I'm announcing a roadmap for URLImage version 3.0. URLImage was developed as a lightweight addition to SwiftUI. There is a way to make it even lighter and better. While the core feartures of the package will stay as is, I want to explore possibilities to provide options to configure the package for your needs. One such thing is downloading and caching.

There are two use cases that drastically differ:

  • First is when an app can work offline and displays cached content;
  • Second - when an app can only work when connected to the internet.

In both cases it is beneficial to cache images locally, however, there are noticeable differences.

When caching content for offline usage, it worth caching not only what is shown, but preload some in advance. Consider a reader app, you probably want to download articles before user opens them, maybe while the app is in the background. This content should stay for a considerably long period of time.

Different example is a shopping app. Items on sale, their availability, changes. It makes little sense to implement long lasting cache. For this apps you may want to follow HTTP Cache-Control header and use the system URLCache.

Currently URLImage version supports both cases, but it requires specific parameters to be set via the options object. Version 3.0 will provide cache control using composition, and improve API for downloading images in the background.

For other improvements, I also plan to refine the view API a bit by removing redundant argument names, give control over authentication, and keep source code clear and compile times fast.

As about the timeline, I can't give any promises except - when it's ready πŸ™‚ I'm actively working on. Stay tuned.

In future I plan to use my Twitter for announcements related to URLImage development, so please follow: https://twitter.com/dmytroanokhin

Hello Dmytro, sounds great.

When you say "API for downloading images in the background" : Current version is downloading on the main thread ?

I ask the quesiton because i am having a problem with my app being unresponsive when image are loading with URLImage.

Hey @manelephant,

"API for downloading images in the background" meaning downloading images without the view. Downloads are asynchronous and callbacks are handled on the queue managed by URLSession.

However, some work is still done on the main thread, like image decoding. If you see issues with scrolling, try using returnCacheElseLoad policy, with a small delay, and loadOnAppear/cancelOnDisappear options.

If that doesn't help, please open a bug and provide as much information as possible.

Great thank you @dmytro-anokhin !!! Gonna try that right away.

Quick update: v3 is now in main πŸŽ‰. I'm updating sample code and will follow up soon. Cheers!