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

Set custom number of lines on a skeleton label #458

Closed YuriFuze closed 2 years ago

YuriFuze commented 2 years ago

Describe the feature or problem you’d like to solve

When we have a label with dynamic heights and set its number of lines to 0 the view loses the ability to draw the lines simulating a text. Instead it works as a normal view skeleton and fills the entire label frame.

Proposed solution

You could add a variable to set a custom number of lines on SkeletonView instead of calculating it based on height or the actual numberOfLines of the UILabel. This way when we face the problem with dynamic heights and unlimited lines we have the intended effect of showing a text skeleton.

Juanpe commented 2 years ago

Hi @YuriFuze 👋🏼

Sorry for the late response. I like the idea, so I'm going to include it in the backlog 👍🏼

Juanpe commented 2 years ago

Hi @YuriFuze, this change has been included in version 1.28.0.

You can check more details in the PR #479

YuriFuze commented 2 years ago

Awesome!

farrasdoko commented 1 year ago

Hi @Juanpe

I have tried using label.skeletonTextNumberOfLines = 1 but the compiler told me that Value of type 'UILabel' has no member 'skeletonTextNumberOfLines'. Then I tried looking for UILabel+SKExtensions.swift file on Podile/SkeletonView but found nothing. I am using v 1.13.0.

farrasdoko commented 1 year ago

Ah sorry, I am using v 1.13.0 instead of 1.30.0 and the skeletonTextNumberOfLines property is defined on v 1.28.0 thats why I didn't find it.