dmytro-anokhin/url-image

URLIMAGE shows empty view in navlink destination

Keno2903 opened this issue · 3 comments

‼️ Please fill in as much information as possible ‼️

Summary and/or background
The URLIMAGE works perfectly unless it is put in a destination view of a navigation Link. If so, it only returns an empty view.

OS and what device you are using

  • OS: IOS
  • Device or simulator = iPhone 12 Pro Max
  • Are you building a widget or an extension?
    No

Version of URLImage library
3.0.1

Hey, I'm looking into the problem. It seems that navigation view recreates URLImage object and this breaks loading logic on appearance. One workaround is to load images immediately, when navigation renders destination body. Set .environment(\.urlImageOptions, URLImageOptions(loadOptions: [ .loadImmediately ])).

Your solution works perfectly, thanks a lot. Keep up the good work :)

Recently I was getting many similar bug reports, so I decided to change default behaviour to start loading when the view is rendered. There's also a new section in README that explains differences: Start Loading. If you're using List you may get better performance with old behaviour.