ra1028/Carbon

Detect component appear/disappear?

andrefmsilva opened this issue · 2 comments

Hi,

in apple documentation for didEndDisplaying we read:

Use this method to detect when a cell is removed from a collection view, as opposed to monitoring the view itself to see when it disappears.

this means that this method can't be used to implement the contentDidEndDisplay``contentWillDisplay...

for me in iOS 13.1 b4 this methods won't fire when we really need them. I need to perform some lazy loading work in the component and without this is really hard to detect when to cancel it.

Hi @Zasuk

I checked if contentDidEndDisplay would be called when the cell disappeared in the Carbon example app.
Then, it was called at the timing I intended in my iPhone with iOS 13.1 beta4.
I don't know if I understood your point clearly. Can you give me more detailed motivation and context?

Hi,
i've tested again and now it is working for me 🤔
Basically i was trying to lazy load component content (images for example) and this method was not firing, preventing me from canceling previous work.

I was storing the Disposable (ReactiveSwift) in the component but now i'm storing it in the view and canceling it when it is rendered again or when the component contentDidEndDisplay