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

UnSwizzle methods #381

Closed alexookah closed 3 years ago

alexookah commented 3 years ago

Summary

Resolves #373 Resolves #358 Resolves #202 Resolves #352

This PR adds methods to unSwizzleLayoutSubviews & unSwizzleTraitCollectionDidChange in order not to interfere with other controller methods when skeletonView is hidden. These methods are being called once if swizzle is enabled at recursiveHideSkeleton.

Unswizzle is simple re-run with reverted selectors to stop swizzle.

My PL also includes a toolbar in textField to test whether an infinite loop exists when changing floating to normal keyboard (in iPad).

Let me know what you think.

Requirements (place an x in each of the [ ])

Juanpe commented 3 years ago

Hi @alexookah, thanks for contributing.

IMHO, we should investigate why the app is crashing because of swizzling, but I agree with you that this could be a good solution meanwhile. I've checked the code, and I don't have anything to add :)

I'm going to merge it and release a new version, including this PR, to release this fix asap.

Thanks again :)

alexookah commented 3 years ago

Thanks for your review @Juanpe. In my case the app was not really crashing. it just was getting into an infinite loop of skeletonLayoutSubviews when other layoutSubviews were run on the controller that had skeletonView enabled (like in iPad floating keyboard to normal) At least this PL stops being notified from other layoutSubviews.

I believe that the following tickets can be closed now: https://github.com/Juanpe/SkeletonView/issues/358 https://github.com/Juanpe/SkeletonView/issues/352 https://github.com/Juanpe/SkeletonView/issues/202

Juanpe commented 3 years ago

Yep, closed :)