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.51k stars 1.1k forks source link

layoutSubviews swizzling causes an infinite loop #495

Open artgoncharov opened 2 years ago

artgoncharov commented 2 years ago

Description

layoutSubviews swizzling causes issues for UIKit.

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

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


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.

https://user-images.githubusercontent.com/50835041/159222726-e042e8e0-cd97-43e0-9f01-85c98e54771b.mov

Sample project

check4ismail commented 2 years ago

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 commented 2 years ago

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

check4ismail commented 2 years ago

Hey @artgoncharov ,

Here's what I've done so far:

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 commented 2 years ago

@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 commented 2 years ago

@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:

artgoncharov commented 2 years ago

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 commented 2 years ago

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:

https://user-images.githubusercontent.com/1409041/159485994-b0e9f990-dfc4-480a-a876-183228ac7f9a.mov

artgoncharov commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

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

JackTheTapper commented 2 years ago

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 commented 5 months ago

I'm facing the same problem (version 1.8.2)

ihnatmoisieiev commented 1 month ago

Same issue. Any updates here?