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

layoutSubviews swizzling causes an infinite loop #495

Open
4 of 8 tasks
artgoncharov opened this issue Mar 21, 2022 · 13 comments
Open
4 of 8 tasks

layoutSubviews swizzling causes an infinite loop #495

artgoncharov opened this issue Mar 21, 2022 · 13 comments

Comments

@artgoncharov
Copy link

artgoncharov commented Mar 21, 2022

Description

layoutSubviews swizzling causes issues for UIKit.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • discussion

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

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

SkeletonView Environment:

SkeletonView version: 1.29.2
Xcode version: 13.2.1
Swift version: 5

Steps to reproduce:

  1. Setup the floating keyboard on iPad
  2. Open app in a slide over mode
  3. Show a skeleton animation
  4. Focus on a textfield with a toolbar

Expected result:

Keyboard is shown

Actual result:

App freezes in the infinite loop

Attachments:

Logs, screenshots, sample project, funny gif, etc.

loop480.mov

Sample project

@check4ismail
Copy link

Hey @artgoncharov ,

Would you be able to include your code on here? If not, feel free to share code that mimics the issue. It'll help further narrow down the issue to figure out what's going on. Thanks!

@artgoncharov
Copy link
Author

Hello @check4ismail I've attached the sample project in the description. I will dup the link here Sample project

@check4ismail
Copy link

Hey @artgoncharov ,

Here's what I've done so far:

  • Downloaded your sample project
  • Instead of using Cocoapods, went with Swift Package Manager (my preferred package manager)
  • Ran the app using the an iPad Pro 11-inch (3rd generation) simulator running iOS 15.2

I wasn't able to replicate the issue and was able to pull up the keyboard as expected from Textfield after tapping the Toggle Skeleton button. Is there anything else I'm missing here just to make sure we're on the same page?

@artgoncharov
Copy link
Author

@check4ismail just to make sure, did you set up the floating keyboard before? Also, run the app in slide over mode (check the vid). BTW, you can use Reproduce Infinite Loop button. Thank you in advance!

@check4ismail
Copy link

@artgoncharov ,

Appreciate you mentioning those things as well. And correct, I was able to do the following at the same time: 1) type onto the Textfield using a floating keyboard, 2) make sure the app is running in slide over mode

If you're curious about the sequence of events here it is below:

  • Run app
  • Change app view mode to slide over mode
  • Change keyboard to floating
  • Tap on Reproduce Infinite Loop button
  • From there, I was able to type into the Textfield without an issue

@artgoncharov
Copy link
Author

I think we need someone else to try. I just tried to reproduce on a fresh install and I'm still able to reproduce.

@Juanpe
Copy link
Owner

Juanpe commented Mar 22, 2022

Hi! I've downloaded the project and I can reproduce this issue. I'm not exactly sure what it's happening 🤔

The steps to reproduce it are:

  • Run app
  • Change app view mode to slide over mode
  • Change keyboard to floating
  • Toggle skeleton
  • When skeleton is active, tap on the text field.
  • The memory increases exponentially.
Screen.Recording.2022-03-22.at.13.50.47.mov

@artgoncharov
Copy link
Author

@Juanpe it's an infinite loop :) if you remove this swizzling https://github.com/Juanpe/SkeletonView/blob/main/SkeletonViewCore/Sources/Internal/UIKitExtensions/UIView%2BSwizzling.swift#L34 you won't get this issue

@Juanpe
Copy link
Owner

Juanpe commented Mar 22, 2022

Yeah, exactly, but the question is what is the cause of this infinite loop 😅 I can see that when the keyboard appears, some constraints are broken and it seems could be the cause 🤔

@artgoncharov
Copy link
Author

Yes, and one more thing, it's reproduced only for textfields with input accessory view, some layout work is done there

@JackTheTapper
Copy link

Hi, any news on this? Im seeing the same thing, when updating collectionviews and am eager to hear how we can aviod this loop

@drash-course
Copy link

I'm facing the same problem (version 1.8.2)

@ihnatmoisieiev
Copy link

Same issue. Any updates here?

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

6 participants