Hello Developers, we are coming with a new story
As we had viewed many instances some of the first-rate web sites and cell apps the usage of gradient animation till fetching information from the server and populate on the list.
We can additionally put into effect this kind of animation in UICollectionView or UITableView controls to make it appear like brilliant ever.
Why we are placing this animation?
The gain in the back of this kind of animation is we don’t have to block the person interface whilst fetching the facts from the server by way of placing a loader or something. like we be aware of too plenty loader and UI block irritates the user. But this kind of animation maintain customers fill stay with apps :)
How can I Integrate into my code?
Easy Easy, Now we are going to combine into our list, First of all, go to this fantastic Skeleton Library and combine into your Xcode mission the use of Pod or Carthage. or you can sincerely put it.
Pod:
Carthage:
After putting in the dependency, You can locate isSkeletonable attribute in your Storyboard/Xib Attribute inspector.
If you choose to exhibit animation in your manage like (UILabel, UIButton, UIView, etc…) simply set it to On.
Setup in UITableViewCell :
I hope you apprehend until now and set isSkeletonable to On mode. Now comply with the under process to show animation in UITableView.
In your UITablViewCell classification put under code in awakeFromNib() to begin the animation.
But if you have too many controls in Cell you can use the below shortcut to apply the animation.
And additionally add a technique to cover Skeleton when facts is reachable after a Server request. put beneath approach in UITableViewCell type awakeFromNib().
Now we cross to controller and populate facts in UITableView. We have one User mannequin for data. which incorporates a name, point out name, description, and image.
Create an array of SomeData in ViewController which is used as Datasource of TableView.
Here we are imposing UITableViewDataSource methods, to show animation and statistics in cells.
In the numberOfRowsInSection technique there are line return users?.count ?? 10 this suggests that if customers array is null (it potential until now customers statistics is no longer available) then it shows default animation phone in any other case it returns array count.
In the cellForRowAt approach first, we take a look at if customers array is nil then we sincerely proceed with animation in any other case if customers array is no longer nil then we first disguise the animation then populate the data.
Below is the one instance which I used in my present day project, You can see this stunning animation.
0 Comments