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

Improved number of lines calculation #479

Closed Juanpe closed 2 years ago

Juanpe commented 2 years ago

Summary

The goal of this PR is to improve how the number of lines for text nodes is calculated. Until now, the library decided to use the value of the numberOfLines property. Now, exist a new type to define how the library should calculate the number.

Before

You could set the number of lines by setting the numberOfLines property:

label.numberOfLines = 2

/// Both the label and the skeleton have 2 lines

After

Now, you can be more specific:

label.numberOfLines = 2
label.skeletonTextNumberOfLines = 1

/// The label has 2 lines but the skeleton has only one.

Here the SkeletonTextNumberOfLines definition:

enum SkeletonTextNumberOfLines {

    /// Returns `numberOfLines` value.
    case inherited

    /// Returns the specific number of lines specified as the associated value.
    case custom(Int)

}
github-actions[bot] commented 2 years ago
Warnings
:warning: Consider **also** updating the README for other languages.

Generated by :no_entry_sign: Danger Swift against 068b984440e97fb2353046c503204fcf3014d259