SolvedSkeletonView SkeletonView not working in TableViewCell with custom class

What did you do?

Changed the UITableViewDataSource to SkeletonTableViewDataSource
Returned the correct Cell Identifier
Changed estimatedRowHeight to a fixed height (150), as I am using automatic row height
Made all my views skeletonable, including the UITableView and the cell themselves
Tried to set myTableView.showSkeleton() on viewDidAppear() and in a custom button, both with the same unexpected result

What did you expect to happen?

I am successfully using SkeletonView while loading cells of a UICollectionView, so I expected the cells to show skeletons as well.

What happened instead?

I only see one grey solid where the UITableView should appear. Not the views of my cell, only a grey solid.

Unexpected result

I then researched and found another, similar issue of someone who was unable to get the subviews in the debugger, which happens for me as well. Nothing underneath the FollowCell seems to be skeletonable, while everything is set up correctly:

Debug

There are no cells in my view hierarchy that are blocking the skeletons (everything has isSkeletonable = true).

Steps to reproduce the behavior

import SkeletonView
add UITableView as a subview to a UIViewController
register cell with custom class
make all views skeletonable
use showSkeleton() to show the skeletons (in viewDidAppear)

SkeletonView Environment

SkeletonView version: 1.4.1
Xcode version: 10.1
Swift version: 4.2

12 Answers

✔️Accepted Answer

@pennywise94 I ran into this issue too; the giant solid happens because calling showSkeleton() on a UITableView calls addDummyDataSource(), which calls reloadData(), which immediately afterwards results in visibleCells returning an empty array. However, it turns out that only visibleCells are skeleton'd, so that explains why nothing is recursively skeleton'd below the UITableView. This definitely seems like a bug; if I get a chance I'll submit a PR to fix it.

In the meantime, instead of calling tableView.showSkeleton() in viewDidAppear(), tableView.visibleCells.forEach { $0.showSkeleton() } worked for me. Let me know how that goes!

Hi mate, thanks for the reply. I eventually figured out that it had to do with the contentView for me. I added all my constraints to the contentView rather than the cell itself and it works like that. I also create a function addSkeleton() which is called in viewDidLayoutSubviews() and this works just fine for me.

Other Answers:

@pennywise94 I ran into this issue too; the giant solid happens because calling showSkeleton() on a UITableView calls addDummyDataSource(), which calls reloadData(), which immediately afterwards results in visibleCells returning an empty array. However, it turns out that only visibleCells are skeleton'd, so that explains why nothing is recursively skeleton'd below the UITableView. This definitely seems like a bug; if I get a chance I'll submit a PR to fix it.
In the meantime, instead of calling tableView.showSkeleton() in viewDidAppear(), tableView.visibleCells.forEach { $0.showSkeleton() } worked for me. Let me know how that goes!

Hi mate, thanks for the reply. I eventually figured out that it had to do with the contentView for me. I added all my constraints to the contentView rather than the cell itself and it works like that. I also create a function addSkeleton() which is called in viewDidLayoutSubviews() and this works just fine for me.

thank u... finally it's work 😍😍😍

Glad I could help!

@erfanwakka Basically what I did was, instead of adding the views of my custom UITableViewCell directly like this:

addSubview(testLabel)
testLabel.topAnchor.constraint(equalTo: topAnchor).isActive = true

I would add it to the contentView, like this:

contentView.addSubview(testLabel)
testLabel.topAnchor.constraint(equalTo: contentView.topAnchor).isActive = true

And this resolved my problem.

A couple of other notes:

  • It seems important to call showSkeleton() when the view is properly loaded. I usually do this in viewDidLayoutSubviews() if the layout won't change afterwards or using an async function in viewDidLoad() (DispatchQueue.main.async). For UICollectionViews, use the function collectionView.prepareSkeleton.
  • Make sure your labels in your cell class contain some text. When I set no text, the labels are invisible and can't get the skeletonView. Simply nothing is enough to make it appear (customLabel.text = "").
  • Make sure all views in the hierarchy are skeletonable. Inspect this using the debugger tool that comes with this awesome library.

Related Issues:

8
SkeletonView Wrong skeleton view width on iPhone 8 plus
Ok I've found my problem I was calling showSkeleton in viewDidLoad Moving it to viewDidAppear fixed ...
3
SkeletonView SkeletonView not working in TableViewCell with custom class
@pennywise94 I ran into this issue too; the giant solid happens because calling showSkeleton() on a ...
521
ant motion 模版代码下载下来导入到dva搭建的项目里面,启动时报错(npm start)
开启 JavaScript 就可以了 你好,我下载的Home项目引入到项目工程里面,为了方便,我全部放到了components下面,引入和基本流程没有问题。在家里的win10上面启动没有报错,在win...
156
react native modal The statusbar turns white when the modal is open (only on certain devices)
statusBarTranslucent property has been added to Modal of RN 0.62 I think this problem has been solve...
138
lottie ios animation stop after enter background
Seem we have this to pause in background and restart when it reach foreground animationView.backgrou...
76
react native circular progress No component found for view with name "ARTSurfaceView"
I drag and dropped node_modules/react-native/Libraries/ART/ART.xcodeproj somewhere to my Xcode proje...
65
react native reanimated V2: Upgrade error InnerNativeModule.installCoreFunctions
was facing same problem react-native: 0.66.0 react-native-reanimated: ^2.3.0-beta.2 ...
61
uCrop FileUtils NumberFormatException
This is not a complete solution just nothing will happen But I think users should be able to open fi...
52
react native modal Error property 'left' is not supported by native animated module when using swipe
This is not due to react native limitations Keeping it as simple as the above ...
50
react native reanimated RN 0.61 Android build fails
I am still facing this This likely has to do with AndroidX or other things of which I am somewhat ig...
46
react native circular progress Invariant Violation: requireNative Component: "RNSVGPath" was not found in the UIManager
for any future person coming here with this issue that I faced on Android make sure to recompile you...
36
moviepy ImageMagick not detected by moviepy while using SubtitlesClip
comment out (or remove the line that reads) <policy domain=path rights=none pattern=@* /> <!-- <poli...
36
react native modal Tap outside to close
@Doko-Demo-Doa according to the source code haven't implemented yet there is no close event on backd...
29
react native modal How to avoid keyboard for bottom half modal
FWIW for those coming from Google Let's say we have a bottom half modal with some TextInput ...
29
react native reanimated TurboModuleRegistry NativeReanimated error
When loading with 2.0.0-alpha.8 I'm still running into ExceptionsManager.js:179 Invariant Violation:...
23
manim Failed to build pycairo in ubuntu
I got the same problem during the installation and these commands solved the problem. ...
21
moviepy Unable to run the sample code! Getting errors. Plase Help
I just figured this out. imagemagick (ie convert) has a policy.xml file that stops you from accessin...
20
react native modal How could we add swipe down to close function?
+1 for this feature please Hi I love the way this module: https://github.com/maxs15/react-native-mod...
20
react native reanimated [Jest] V2 - rc2 Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated'
I opened a PR but if you guys want a temporary fix Use ds300/patch-package and put this on patches/r...
18
react native reanimated Unable to resolve module ./abs
@jakub-gonet I think in my case watchman was the culprit as even after --reset-cache the issue was s...
16
barba Update body class?
Got it working with events too: Is it possible to update the body class between transitions? ...
15
react native reanimated [RN 0.66] iOS build failure: 'boost/operators.hpp' file not found
Try react-native-reanimated: 2.3.0-beta.2 It has fix for search paths Description After updating to ...
13
react native modal error: bundling failed: Error: Unable to resolve module `./animations`
this command fixed my issue npm start -- --reset-cache I upgraded my react-native-modal from 7.0.2 t...
13
react native reanimated Android only -> E/ReactNativeJS: undefined is not an object (evaluating '_ReanimatedModule.default.configureProps')
Make sure that you've added new ReanimatedPackage(),in MainApplication.java under getPackages Import...
12
moviepy AttributeError: module 'moviepy.audio.fx.all' has no attribute 'audio_fadein'
For everyone that has the same issue i solved it by modifying the selected init file shown in the pi...
12
lottie android JSON Reader AssertionError when doInBackground (Android 7, 8)
We are having the same issues (Lottie 2.5.5) - only Android 8 So hope to find a fix soon ...
8
aseprite Skia build fails on Mojave
For me I have to use @adennen 's solution and also disable webp via skia_use_libwebp=false due to I ...
7
animated tab bar Major issue when using hidesBottomBarWhenPushed. Please investigate
@sentiasa Hi! It's very easy to solve this issue by using this: Hey guys ...
7
barba CF7 Wordpess reload
Hi The newest version of wpcf7 needs some code changes: Hi there ...
7
react native modal modal not begin from bottom
<Modal style={{ margin: 0 }}>....</Modal> can fix your problem I try to make modal that begin from b...
5
CompactCalendarView Show Event indicators to currently selected day
I've released a new beta version: Let me know if you have any feedback While Adding events to curren...
5
lottie ios Use image resources in lottie-ios
Hi guys I think the best solution is AnimationImageProvider Lottie has AnimationImageProvider I am s...
5
barba View afterEnter hook on browser refresh is not triggered
Fixed in @barba/core 2.3.15 Hi there! First of all thanks alot for the great work Using barba since ...
5
react three fiber Panning / Orbit Controls
@gino8080 you can also import OrbitalControl from drei I'm trying to implement a panning system on s...
5
svg.js svg rectangle with select resize and draggy
Oh cmon - you enable pointerevents on purpose for all elements with and then you wonder why the rect...
4
CompactCalendarView Remove First Day as SelectedDayBgColor
Added new xml property and method: Set that to false to not select first day of month Released anew ...
4
barba Uncaught (in promise) Error: xhr: HTTP code is not 200
I may have had some luck with this issue by passing a larger value to the XHR Timeout The default is...
3
FluidTransitions willBlur, didBlur listener not call
Experiencing this again with react-navigation@3.1.0 Perhaps an issue in react-navigation See this th...
3
react three fiber ✍️ Roadmap for 2.x (suggestions welcome)
@samburgers with the last commits that went in you can do this easily Just keep configs in state and...
479
Carthage Carthage builds fail at xcrun lipo on Xcode 12 beta (3,4,5...)
Workaround that works with both Xcode 11 and 12 Works with all versions of Xcode 12 (except beta 1 a...
140
Alamofire “Use Legacy Swift Language Version” with pod 'Alamofire', '~> 4.0'
Have you tried this? http://stackoverflow.com/a/38466703/1054550 I have to convert my project from X...
66
CocoaLumberjack Xcode 9 beta 3 breaks the new os_log logger
Getting the following errors DDOSLogger.m: DDOSLogger.m:58:17: Static_assert failed format argument ...
65
Alamofire iOS 13.3.1 dyld: Library not loaded
Are you using a non-developer Apple ID to install the app to your phone? It looks like iOS 13.3.1 ha...
51
Alamofire Extra argument 'method' in call
I'm getting the same issue with the same error message (Extra argument 'method' in call) with correc...
43
Alamofire Sending GET with JSON in body gets Timeout error
I figured out my problem In my Router I had my GET requests using JSONEncoding: urlRequest = try JSO...
35
Alamofire Alamofire 4.3.0 setting timeout throws NSURLErrorDomain error
Hello I solved the problem with: I pupdated my question in StackOverflow I am using the version 4.3....
30
Carthage carthage build command complains about "Could not find any available simulators for iOS"
I have the exactly the same situation with xCode 10.2 my Carthage was outdated after update to 0.33 ...
30
Eureka PushRow - Prevent Nil
do the trick This may be a basic question - but for a PushRow - is there a way to make it to where i...
28
Alamofire Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0
I'm having almost the exact the same issue: Module compiled with Swift 4.2.1 cannot be imported by t...
26
Carthage How: Please update to the latest Carthage version
This command updates brew itself and does not take formula names the command should be brew upgrade ...