Juanpe / SkeletonView

☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
MIT License
12.53k stars 1.1k forks source link

Transition Delay #379

Closed Gawetaner closed 3 years ago

Gawetaner commented 3 years ago

Transition Delay

If using SkeletonView for views that are mostly updated quickly, the SkeletonView transition looks like a short flashing of the view.

Example: A view that will be updated with an small amount of data loading from the internet will be updated fast enough to skip the SkeletonView animation and transition. Only if network problems occur, the SkeletonView needs to be shown.

Proposed solution

An optional delay applied to the transition, like the transition duration.

Example: If network problems occur and the update of the view takes longer than the specified delay, the SkeletonView will be shown.

Additional context

I already tried to implement the Delay for the transition, but I didn't find out why 2 transitions are used (https://github.com/Juanpe/SkeletonView/blob/main/Sources/Transitions/UIView%2BTransitions.swift) and when they are used.

Juanpe commented 3 years ago

Hi @Gawetaner, I think it could be a good idea, in order to delay the transition if the developer wants.

I'm going to include it in the backlog. BTW, feel free to create a PR with the changes :)

Juanpe commented 3 years ago

Hi @Gawetaner, this feature was released :)