Skip to content

Commit

Permalink
Global setter for useFontLineHeight (Juanpe#454)
Browse files Browse the repository at this point in the history
- Add useFontLineHeight to SkeletonViewAppearance.
- Update README file to include useFontLineHeight under SkeletonAppearance.
  • Loading branch information
Sharma Elanthiraiyan authored Sep 14, 2021
1 parent 14c138e commit af94b7e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ Default values:
- *default: `SkeletonGradient(baseColor: .skeletonDefault)`*
- **multilineHeight**: CGFloat
- *default: 15*
- **useFontLineHeight**: Bool
- *default: true*
- **multilineSpacing**: CGFloat
- *default: 10*
- **multilineLastLineFillPercent**: Int
Expand All @@ -315,6 +317,7 @@ You can also specifiy these line appearance properties on a per-label basis:
- **linesCornerRadius**: Int
- **skeletonLineSpacing**: CGFloat
- **skeletonPaddingInsets**: UIEdgeInsets
- **useFontLineHeight**: Bool


### 🎨 Custom colors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class SkeletonViewAppearance {

public var multilineHeight: CGFloat = 15

public var useFontLineHeight: Bool = true

public var multilineSpacing: CGFloat = 10

public var multilineLastLineFillPercent: Int = 70
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extension UILabel: SkeletonTextNode {
}

var usesTextHeightForLines: Bool {
get { return ao_get(pkey: &SkeletonTextNodeAssociatedKeys.usesTextHeightForLines) as? Bool ?? true }
get { return ao_get(pkey: &SkeletonTextNodeAssociatedKeys.usesTextHeightForLines) as? Bool ?? SkeletonAppearance.default.useFontLineHeight }
set { ao_set(newValue, pkey: &SkeletonTextNodeAssociatedKeys.usesTextHeightForLines) }
}

Expand Down Expand Up @@ -95,7 +95,7 @@ extension UITextView: SkeletonTextNode {
}

var usesTextHeightForLines: Bool {
get { return ao_get(pkey: &SkeletonTextNodeAssociatedKeys.usesTextHeightForLines) as? Bool ?? true }
get { return ao_get(pkey: &SkeletonTextNodeAssociatedKeys.usesTextHeightForLines) as? Bool ?? SkeletonAppearance.default.useFontLineHeight }
set { ao_set(newValue, pkey: &SkeletonTextNodeAssociatedKeys.usesTextHeightForLines) }
}

Expand Down

0 comments on commit af94b7e

Please sign in to comment.