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
I am successfully using SkeletonView while loading cells of a UICollectionView, so I expected the cells to show skeletons as well.
I only see one grey solid where the UITableView should appear. Not the views of my cell, only a grey solid.

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:

There are no cells in my view hierarchy that are blocking the skeletons (everything has isSkeletonable = true).
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 version: 1.4.1
Xcode version: 10.1
Swift version: 4.2
Any tips, ideas or fixes for this? I have come across this issue again, but would love to use SkeletonView for my UITableViews. Figured out that it probably has something to do with the contentView of the UITableViewCells - could that be? As you can see in the debug screenshot above, there are no subSkeletons shown under the UITableViewCells, which makes me think something (the contentView?) is blocking it. However, in the initializer of the custom UITableView class, I set contentView.isSkeletonable to true.
@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!
@pennywise94 I ran into this issue too; the giant solid happens because calling
showSkeleton()on aUITableViewcallsaddDummyDataSource(), which callsreloadData(), which immediately afterwards results invisibleCellsreturning an empty array. However, it turns out that only visibleCells are skeleton'd, so that explains why nothing is recursively skeleton'd below theUITableView. 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()inviewDidAppear(),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.
@pennywise94 I ran into this issue too; the giant solid happens because calling
showSkeleton()on aUITableViewcallsaddDummyDataSource(), which callsreloadData(), which immediately afterwards results invisibleCellsreturning an empty array. However, it turns out that only visibleCells are skeleton'd, so that explains why nothing is recursively skeleton'd below theUITableView. This definitely seems like a bug; if I get a chance I'll submit a PR to fix it.
In the meantime, instead of callingtableView.showSkeleton()inviewDidAppear(),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.
Could you explain more what did you do ?
@pennywise94 I ran into this issue too; the giant solid happens because calling
showSkeleton()on aUITableViewcallsaddDummyDataSource(), which callsreloadData(), which immediately afterwards results invisibleCellsreturning an empty array. However, it turns out that only visibleCells are skeleton'd, so that explains why nothing is recursively skeleton'd below theUITableView. This definitely seems like a bug; if I get a chance I'll submit a PR to fix it.
In the meantime, instead of callingtableView.showSkeleton()inviewDidAppear(),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 馃槏馃槏馃槏
@pennywise94 I ran into this issue too; the giant solid happens because calling
showSkeleton()on aUITableViewcallsaddDummyDataSource(), which callsreloadData(), which immediately afterwards results invisibleCellsreturning an empty array. However, it turns out that only visibleCells are skeleton'd, so that explains why nothing is recursively skeleton'd below theUITableView. This definitely seems like a bug; if I get a chance I'll submit a PR to fix it.
In the meantime, instead of callingtableView.showSkeleton()inviewDidAppear(),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:
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.customLabel.text = "").Hi @pennywise94, I've added a new illustration in the README file explaining how you should specify which elements are skeletonables using table views. Could you check if your config it's valid? I think this issue could be related to this.
Hi @Juanpe, first of all: many thanks for this great repository.
I have looked at the image and this is exactly how my project is set up. All my UITableViews are set up like you describe in the illustration. However, I didn't get SkeletonView to work with pinning my labels and views to the cell itself, such as:
exampleLabel.topAnchor.constraint(equalTo: topAnchor, constant: 16).isActive = true
For me, it started to work as soon as I replaced my anchor to the contentView, like this:
exampleLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 16).isActive = true
Of course I did this for all my anchors. I have then also set the contentView to be skeletonable, but I can now confirm that removing contentView.isSkeletonable = true does not affect the SkeletonView. So it is indeed not necessary to set the contentView to be skeletonable, but I find it needs to be pinned to the contentView. Is that correct?
Would enabling the skeleton for the contentView have significant downsizes for my (or any) project? I have now removed this, as it still works as expected.
Thank you for the feedback!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
hi @pennywise94, sorry for the late reply. Actually, it doesn't need it.
Is this issue fixed then?
Thanks
Yep, got it working perfectly fine! ContentView is indeed not needed, following everything on the readme works as expected. Don't know what exactly went wrong first, but re-doing it kind of solved it for me. Thank you again.
Most helpful comment
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 = trueI would add it to the contentView, like this:
contentView.addSubview(testLabel)testLabel.topAnchor.constraint(equalTo: contentView.topAnchor).isActive = trueAnd this resolved my problem.
A couple of other notes:
viewDidLayoutSubviews()if the layout won't change afterwards or using an async function inviewDidLoad()(DispatchQueue.main.async). For UICollectionViews, use the functioncollectionView.prepareSkeleton.customLabel.text = "").