Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnSwizzleLayoutSubviews should not have a delay. #490

Open
alexookah opened this issue Feb 9, 2022 · 5 comments
Open

UnSwizzleLayoutSubviews should not have a delay. #490

alexookah opened this issue Feb 9, 2022 · 5 comments

Comments

@alexookah
Copy link
Contributor

alexookah commented Feb 9, 2022

Hello,
I happened to have another infinite loop issue with swizzle methods. I remember I had fixed this in the past with adding the unSwizzle methods.
#381

In order to fix my new issue which was trying to show a floatingKeyboard right after hidingSkeletonView. I think that the unSwizzle method occurs too late.

The swizzle delay 0.01 maybe makes sense to me but not the unSwizzle delay. Also does unSwizzle really need to be in async method?

https://github.com/Juanpe/SkeletonView/blob/main/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView%2BSwizzling.swift#L44

When receiving the notification with skeletonDidDisappear the swizzle methods are still active (due to the delay 0.01). It should be triggerred after the unswizzle are completed.
The sk.isSkeletonActive should return false only when the unSwizzle method is disabled in my opinion.

Should I make a MR that removes the delay for unSwizzle methods?

I was also thinking about some delegate about the didDisappear or some callback that runs after the unswizzle is triggered. Do you like that idea?

@alexookah
Copy link
Contributor Author

Added a MR to remove the async delay for unSwizzle methods
#491

@alexookah
Copy link
Contributor Author

I was thinking, maybe the async+delay should also be removed from the swizzle methods in case the hideSkeletonView is run immediately after showSkeletonView

@artgoncharov
Copy link

Hello, I have a sample to reproduce the issue here: #495
Unfortunately looks like swizzling by itself breaks the internal logic of UIKit

@alexookah
Copy link
Contributor Author

alexookah commented Mar 21, 2022

When Skeleton is active and you try to show a floating keyboard it will produce infinite loop.

In order to avoid this and you want to show keyboard do it after stopping the skeleton Animation with a delay 0.02 seconds. (work-around)

@artgoncharov
Copy link

I know that it produce an infinite loop, that's why I've opened the issue :)
Unfortunately, yours workaround it's not a workaround, I have a modular app, some part of the screen still loading but another one it ready for the interaction. Why one part should block another one? That's the main reason why we all should avoid swizzling in production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants