Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ff1a7e299b | |||
| 4994907234 | |||
| 17fb1b9950 | |||
| 138dc8bf82 | |||
| 0b308f5ef5 | |||
| af94b7e30b | |||
| 14c138ec3e | |||
| 2691572392 | |||
| 1b9586e2d7 | |||
| a819e69cee | |||
| 88cd082d8e |
@@ -1,7 +1,7 @@
|
||||
name: CD
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
pull_request_target:
|
||||
branches: [main]
|
||||
types: [closed]
|
||||
|
||||
@@ -61,4 +61,4 @@ jobs:
|
||||
🎉 New release ${{ steps.publish_release.outputs.tag_name }} is out 🚀
|
||||
|
||||
Check out all the changes here:
|
||||
${{ steps.publish_release.outputs.html_url }}
|
||||
${{ steps.publish_release.outputs.html_url }}
|
||||
|
||||
@@ -35,4 +35,16 @@ jobs:
|
||||
run: |
|
||||
set -eo pipefail
|
||||
pod lib lint --allow-warnings
|
||||
pod trunk push --allow-warnings
|
||||
pod trunk push --allow-warnings
|
||||
|
||||
- name: Tweet the release
|
||||
uses: ethomson/send-tweet-action@v1
|
||||
with:
|
||||
consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
|
||||
consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
|
||||
access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
|
||||
access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
|
||||
status: |
|
||||
🎉 New release ${{ steps.publish_release.outputs.tag_name }} is out 🚀
|
||||
Check out all the changes here:
|
||||
${{ steps.publish_release.outputs.html_url }}
|
||||
|
||||
@@ -63,9 +63,9 @@ Enjoy it! 🙂
|
||||
|
||||
## 🎬 Guides
|
||||
|
||||
| [](https://youtu.be/75kgOhWsPNA)|[](https://youtu.be/MVCiM_VdxVA)|[](https://youtu.be/Qq3Evspeea8)|[](https://youtu.be/ZOoPtBwDRT0)|[](https://www.youtube.com/watch?v=Zx1Pg1gPfxA)
|
||||
|:---: | :---: |:---: | :---: | :---:
|
||||
|[**SkeletonView Guides - Getting started**](https://youtu.be/75kgOhWsPNA)|[**How to Create Loading View with Skeleton View in Swift 5.2**](https://youtu.be/MVCiM_VdxVA) by iKh4ever Studio|[**Create Skeleton Loading View in App (Swift 5) - Xcode 11, 2020**](https://youtu.be/Qq3Evspeea8) by iOS Academy| [**Add An Elegant Loading Animation in Swift***](https://youtu.be/ZOoPtBwDRT0) by Gary Tokman| [**Cómo crear una ANIMACIÓN de CARGA de DATOS en iOS**](https://www.youtube.com/watch?v=Zx1Pg1gPfxA) by MoureDev
|
||||
| [](https://youtu.be/75kgOhWsPNA)|[](https://youtu.be/MVCiM_VdxVA)|[](https://youtu.be/Qq3Evspeea8)|[](https://www.youtube.com/watch?v=Zx1Pg1gPfxA)
|
||||
|:---: | :---: | :---: | :---:
|
||||
|[**SkeletonView Guides - Getting started**](https://youtu.be/75kgOhWsPNA)|[**How to Create Loading View with Skeleton View in Swift 5.2**](https://youtu.be/MVCiM_VdxVA) by iKh4ever Studio|[**Create Skeleton Loading View in App (Swift 5) - Xcode 11, 2020**](https://youtu.be/Qq3Evspeea8) by iOS Academy| [**Cómo crear una ANIMACIÓN de CARGA de DATOS en iOS**](https://www.youtube.com/watch?v=Zx1Pg1gPfxA) by MoureDev
|
||||
|
||||
|
||||
## 📲 Installation
|
||||
@@ -268,7 +268,7 @@ You can set some properties for multilines elements.
|
||||
|
||||
| Property | Values | Default | Preview
|
||||
| ------- | ------- |------- | -------
|
||||
| **Filling percent** of the last line. | `0...100` | `70%` | 
|
||||
| **Filling percent** of the last line.<br/>Please note that for views without multiple lines, the single line will be considered as the last line and **lastLineFillPercent** will be applied to that single line. | `0...100` | `70%`| 
|
||||
| **Corner radius** of lines. (**NEW**) | `0...10` | `0` | 
|
||||
|
||||
|
||||
@@ -295,6 +295,8 @@ Default values:
|
||||
- *default: `SkeletonGradient(baseColor: .skeletonDefault)`*
|
||||
- **multilineHeight**: CGFloat
|
||||
- *default: 15*
|
||||
- **useFontLineHeight**: Bool
|
||||
- *default: true*
|
||||
- **multilineSpacing**: CGFloat
|
||||
- *default: 10*
|
||||
- **multilineLastLineFillPercent**: Int
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "SkeletonView"
|
||||
s.version = "1.24.2"
|
||||
s.version = "1.25.1"
|
||||
s.summary = "An elegant way to show users that something is happening and also prepare them to which contents he is waiting"
|
||||
s.description = <<-DESC
|
||||
Today almost all apps have async processes, as API requests, long runing processes, etc. And while the processes are working, usually developers place a loading view to show users that something is going on.
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
F53D731B26D3A35100249D46 /* SkeletonExtended.swift in Sources */ = {isa = PBXBuildFile; fileRef = F53D731A26D3A35100249D46 /* SkeletonExtended.swift */; };
|
||||
F53D731C26D3A35100249D46 /* SkeletonExtended.swift in Sources */ = {isa = PBXBuildFile; fileRef = F53D731A26D3A35100249D46 /* SkeletonExtended.swift */; };
|
||||
F53D731F26D3AC4000249D46 /* SkeletonTreeNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = F556F70726D38F3100A80B83 /* SkeletonTreeNode.swift */; };
|
||||
F53D732326D3C3A800249D46 /* UILabel+SKExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F53D732226D3C3A800249D46 /* UILabel+SKExtensions.swift */; };
|
||||
F53D732426D3C3A800249D46 /* UILabel+SKExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F53D732226D3C3A800249D46 /* UILabel+SKExtensions.swift */; };
|
||||
F556F56626CD1F3900A80B83 /* SkeletonAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_9 /* SkeletonAppearance.swift */; };
|
||||
F556F56726CD1F3900A80B83 /* SkeletonLayerBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_11 /* SkeletonLayerBuilder.swift */; };
|
||||
F556F56826CD1F3900A80B83 /* SkeletonMultilineLayerBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_12 /* SkeletonMultilineLayerBuilder.swift */; };
|
||||
@@ -86,8 +88,8 @@
|
||||
F556F6C726CE2A2100A80B83 /* UILabel+IBInspectable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F556F6C526CE2A2100A80B83 /* UILabel+IBInspectable.swift */; };
|
||||
F556F6C926CE2A4A00A80B83 /* UITextView+IBInspectable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F556F6C826CE2A4A00A80B83 /* UITextView+IBInspectable.swift */; };
|
||||
F556F6CA26CE2A4A00A80B83 /* UITextView+IBInspectable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F556F6C826CE2A4A00A80B83 /* UITextView+IBInspectable.swift */; };
|
||||
F556F6CC26CE2A7400A80B83 /* UITextView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F556F6CB26CE2A7400A80B83 /* UITextView+Extensions.swift */; };
|
||||
F556F6CD26CE2A7400A80B83 /* UITextView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F556F6CB26CE2A7400A80B83 /* UITextView+Extensions.swift */; };
|
||||
F556F6CC26CE2A7400A80B83 /* UITextView+SKExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F556F6CB26CE2A7400A80B83 /* UITextView+SKExtensions.swift */; };
|
||||
F556F6CD26CE2A7400A80B83 /* UITextView+SKExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F556F6CB26CE2A7400A80B83 /* UITextView+SKExtensions.swift */; };
|
||||
F556F6CF26CE2AB800A80B83 /* SkeletonTextNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = F556F6CE26CE2AB800A80B83 /* SkeletonTextNode.swift */; };
|
||||
F556F6D026CE2AB800A80B83 /* SkeletonTextNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = F556F6CE26CE2AB800A80B83 /* SkeletonTextNode.swift */; };
|
||||
F556F6D926CE315A00A80B83 /* UICollectionView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F556F6D826CE315A00A80B83 /* UICollectionView+Extensions.swift */; };
|
||||
@@ -149,6 +151,7 @@
|
||||
/* Begin PBXFileReference section */
|
||||
F53D731726D399E100249D46 /* SkeletonTreeNode+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SkeletonTreeNode+Extensions.swift"; sourceTree = "<group>"; };
|
||||
F53D731A26D3A35100249D46 /* SkeletonExtended.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkeletonExtended.swift; sourceTree = "<group>"; };
|
||||
F53D732226D3C3A800249D46 /* UILabel+SKExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+SKExtensions.swift"; sourceTree = "<group>"; };
|
||||
F556F51026CD1B7900A80B83 /* SkeletonView.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = SkeletonView.podspec; sourceTree = "<group>"; };
|
||||
F556F51126CD1B8000A80B83 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
|
||||
F556F51426CD1BFF00A80B83 /* README_zh.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README_zh.md; path = Translations/README_zh.md; sourceTree = "<group>"; };
|
||||
@@ -199,7 +202,7 @@
|
||||
F556F6C126CE27FD00A80B83 /* SkeletonType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkeletonType.swift; sourceTree = "<group>"; };
|
||||
F556F6C526CE2A2100A80B83 /* UILabel+IBInspectable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+IBInspectable.swift"; sourceTree = "<group>"; };
|
||||
F556F6C826CE2A4A00A80B83 /* UITextView+IBInspectable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextView+IBInspectable.swift"; sourceTree = "<group>"; };
|
||||
F556F6CB26CE2A7400A80B83 /* UITextView+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextView+Extensions.swift"; sourceTree = "<group>"; };
|
||||
F556F6CB26CE2A7400A80B83 /* UITextView+SKExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextView+SKExtensions.swift"; sourceTree = "<group>"; };
|
||||
F556F6CE26CE2AB800A80B83 /* SkeletonTextNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkeletonTextNode.swift; sourceTree = "<group>"; };
|
||||
F556F6D826CE315A00A80B83 /* UICollectionView+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UICollectionView+Extensions.swift"; sourceTree = "<group>"; };
|
||||
F556F6DC26CE33CE00A80B83 /* UIView+Swizzling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Swizzling.swift"; sourceTree = "<group>"; };
|
||||
@@ -411,7 +414,6 @@
|
||||
F556F6BB26CE272600A80B83 /* UILabel+Extensions.swift */,
|
||||
OBJ_25 /* UITableView+CollectionSkeleton.swift */,
|
||||
OBJ_34 /* UITableView+Extensions.swift */,
|
||||
F556F6CB26CE2A7400A80B83 /* UITextView+Extensions.swift */,
|
||||
OBJ_39 /* UIView+AppLifecycleNotifications.swift */,
|
||||
F556F68226CD48F700A80B83 /* UIView+AssociatedObjects.swift */,
|
||||
OBJ_26 /* UIView+CollectionSkeleton.swift */,
|
||||
@@ -442,8 +444,10 @@
|
||||
F556F68626CD49F900A80B83 /* UIView+IBInspectable.swift */,
|
||||
F556F6A026CD566C00A80B83 /* UIView+SKExtensions.swift */,
|
||||
F556F6C526CE2A2100A80B83 /* UILabel+IBInspectable.swift */,
|
||||
F53D732226D3C3A800249D46 /* UILabel+SKExtensions.swift */,
|
||||
F556F6C826CE2A4A00A80B83 /* UITextView+IBInspectable.swift */,
|
||||
F556F6D826CE315A00A80B83 /* UICollectionView+Extensions.swift */,
|
||||
F556F6CB26CE2A7400A80B83 /* UITextView+SKExtensions.swift */,
|
||||
);
|
||||
path = UIKitExtensions;
|
||||
sourceTree = "<group>";
|
||||
@@ -797,7 +801,7 @@
|
||||
F556F56E26CD1F3900A80B83 /* SkeletonCollectionDataSource.swift in Sources */,
|
||||
F556F56F26CD1F3900A80B83 /* SkeletonCollectionDelegate.swift in Sources */,
|
||||
F556F68426CD48F700A80B83 /* UIView+AssociatedObjects.swift in Sources */,
|
||||
F556F6CD26CE2A7400A80B83 /* UITextView+Extensions.swift in Sources */,
|
||||
F556F6CD26CE2A7400A80B83 /* UITextView+SKExtensions.swift in Sources */,
|
||||
F556F57026CD1F3900A80B83 /* SkeletonTableViewProtocols.swift in Sources */,
|
||||
F556F57126CD1F3900A80B83 /* UITableView+CollectionSkeleton.swift in Sources */,
|
||||
F556F57226CD1F3900A80B83 /* UIView+CollectionSkeleton.swift in Sources */,
|
||||
@@ -814,6 +818,7 @@
|
||||
F53D731C26D3A35100249D46 /* SkeletonExtended.swift in Sources */,
|
||||
F556F6F626CE876300A80B83 /* UIView+Swizzling.swift in Sources */,
|
||||
F556F58126CD1F3900A80B83 /* Swizzling.swift in Sources */,
|
||||
F53D732426D3C3A800249D46 /* UILabel+SKExtensions.swift in Sources */,
|
||||
F556F6B626CE258300A80B83 /* GradientDirection+Animations.swift in Sources */,
|
||||
F556F69F26CD553B00A80B83 /* UIView+Extensions.swift in Sources */,
|
||||
F556F58526CD1F3900A80B83 /* Recoverable.swift in Sources */,
|
||||
@@ -877,7 +882,7 @@
|
||||
OBJ_94 /* SkeletonCollectionDataSource.swift in Sources */,
|
||||
OBJ_95 /* SkeletonCollectionDelegate.swift in Sources */,
|
||||
F556F68326CD48F700A80B83 /* UIView+AssociatedObjects.swift in Sources */,
|
||||
F556F6CC26CE2A7400A80B83 /* UITextView+Extensions.swift in Sources */,
|
||||
F556F6CC26CE2A7400A80B83 /* UITextView+SKExtensions.swift in Sources */,
|
||||
OBJ_96 /* SkeletonTableViewProtocols.swift in Sources */,
|
||||
OBJ_97 /* UITableView+CollectionSkeleton.swift in Sources */,
|
||||
OBJ_98 /* UIView+CollectionSkeleton.swift in Sources */,
|
||||
@@ -895,6 +900,7 @@
|
||||
F556F70826D38F3100A80B83 /* SkeletonTreeNode.swift in Sources */,
|
||||
OBJ_113 /* Swizzling.swift in Sources */,
|
||||
F556F6B526CE258300A80B83 /* GradientDirection+Animations.swift in Sources */,
|
||||
F53D732326D3C3A800249D46 /* UILabel+SKExtensions.swift in Sources */,
|
||||
F556F69E26CD553B00A80B83 /* UIView+Extensions.swift in Sources */,
|
||||
OBJ_117 /* Recoverable.swift in Sources */,
|
||||
OBJ_118 /* RecoverableViewState.swift in Sources */,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright SkeletonView. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the MIT License (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://opensource.org/licenses/MIT
|
||||
//
|
||||
// UILabel+SKExtensions.swift
|
||||
//
|
||||
// Created by Juanpe Catalán on 23/8/21.
|
||||
|
||||
import UIKit
|
||||
|
||||
public extension UILabel {
|
||||
|
||||
var skeletonPaddingInsets: UIEdgeInsets {
|
||||
get { return paddingInsets }
|
||||
set { paddingInsets = newValue }
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -7,13 +7,13 @@
|
||||
//
|
||||
// https://opensource.org/licenses/MIT
|
||||
//
|
||||
// UITextView+Extensions.swift
|
||||
// UITextView+SKExtensions.swift
|
||||
//
|
||||
// Created by Juanpe Catalán on 19/8/21.
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UITextView {
|
||||
public extension UITextView {
|
||||
|
||||
var skeletonPaddingInsets: UIEdgeInsets {
|
||||
get { return paddingInsets }
|
||||
@@ -67,7 +67,8 @@ struct SkeletonLayer {
|
||||
multilineSpacing: textView.multilineSpacing,
|
||||
paddingInsets: textView.paddingInsets,
|
||||
alignment: textView.textAlignment,
|
||||
isRTL: holder?.isRTL ?? false)
|
||||
isRTL: holder?.isRTL ?? false,
|
||||
shouldCenterVertically: textView.shouldCenterTextVertically)
|
||||
|
||||
maskLayer.addMultilinesLayers(for: config)
|
||||
}
|
||||
@@ -82,7 +83,8 @@ struct SkeletonLayer {
|
||||
multilineSpacing: textView.multilineSpacing,
|
||||
paddingInsets: textView.paddingInsets,
|
||||
alignment: textView.textAlignment,
|
||||
isRTL: holder?.isRTL ?? false)
|
||||
isRTL: holder?.isRTL ?? false,
|
||||
shouldCenterVertically: textView.shouldCenterTextVertically)
|
||||
|
||||
maskLayer.updateMultilinesLayers(for: config)
|
||||
}
|
||||
|
||||
+2
-1
@@ -24,7 +24,8 @@ struct SkeletonMultilinesLayerConfig {
|
||||
var paddingInsets: UIEdgeInsets
|
||||
var alignment: NSTextAlignment
|
||||
var isRTL: Bool
|
||||
|
||||
var shouldCenterVertically: Bool
|
||||
|
||||
/// Returns padding insets taking into account if the RTL is activated
|
||||
var calculatedPaddingInsets: UIEdgeInsets {
|
||||
UIEdgeInsets(top: paddingInsets.top,
|
||||
|
||||
@@ -23,6 +23,7 @@ protocol SkeletonTextNode {
|
||||
var multilineSpacing: CGFloat { get }
|
||||
var paddingInsets: UIEdgeInsets { get }
|
||||
var usesTextHeightForLines: Bool { get }
|
||||
var shouldCenterTextVertically: Bool { get }
|
||||
}
|
||||
|
||||
enum SkeletonTextNodeAssociatedKeys {
|
||||
@@ -50,7 +51,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) }
|
||||
}
|
||||
|
||||
@@ -79,6 +80,10 @@ extension UILabel: SkeletonTextNode {
|
||||
set { ao_set(newValue, pkey: &SkeletonTextNodeAssociatedKeys.backupHeightConstraints) }
|
||||
}
|
||||
|
||||
var shouldCenterTextVertically: Bool {
|
||||
true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension UITextView: SkeletonTextNode {
|
||||
@@ -95,7 +100,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) }
|
||||
}
|
||||
|
||||
@@ -129,4 +134,7 @@ extension UITextView: SkeletonTextNode {
|
||||
set { ao_set(newValue, pkey: &SkeletonTextNodeAssociatedKeys.paddingInsets) }
|
||||
}
|
||||
|
||||
var shouldCenterTextVertically: Bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ private extension CALayer {
|
||||
|
||||
func calculatedWidthForLine(at index: Int, totalLines: Int, lastLineFillPercent: Int, paddingInsets: UIEdgeInsets) -> CGFloat {
|
||||
var width = bounds.width - paddingInsets.left - paddingInsets.right
|
||||
if index == totalLines - 1 && totalLines != 1 {
|
||||
if index == totalLines - 1 {
|
||||
width = width * CGFloat(lastLineFillPercent) / 100
|
||||
}
|
||||
return width
|
||||
@@ -188,6 +188,19 @@ extension CALayer {
|
||||
isRTL: config.isRTL
|
||||
)
|
||||
}
|
||||
|
||||
guard config.shouldCenterVertically,
|
||||
let maxY = currentSkeletonSublayers.last?.frame.maxY else {
|
||||
return
|
||||
}
|
||||
let verticallyCenterAlignedFrames = currentSkeletonSublayers.map { layer -> CGRect in
|
||||
let moveDownBy = (bounds.height - (maxY + paddingInsets.top + paddingInsets.bottom)) / 2
|
||||
return layer.frame.offsetBy(dx: 0, dy: moveDownBy)
|
||||
}
|
||||
|
||||
for (index, layer) in currentSkeletonSublayers.enumerated() {
|
||||
layer.frame = verticallyCenterAlignedFrames[index]
|
||||
}
|
||||
}
|
||||
|
||||
func updateLayerFrame(for index: Int, totalLines: Int, size: CGSize, multilineSpacing: CGFloat, paddingInsets: UIEdgeInsets, alignment: NSTextAlignment, isRTL: Bool) {
|
||||
@@ -197,7 +210,7 @@ extension CALayer {
|
||||
width: size.width,
|
||||
height: size.height)
|
||||
|
||||
if index == totalLines - 1 && totalLines != 1 {
|
||||
if index == totalLines - 1 {
|
||||
frame = alignLayerFrame(newFrame, alignment: alignment, isRTL: isRTL)
|
||||
} else {
|
||||
frame = newFrame
|
||||
|
||||
@@ -15,11 +15,6 @@ import UIKit
|
||||
|
||||
extension UILabel {
|
||||
|
||||
var skeletonPaddingInsets: UIEdgeInsets {
|
||||
get { return paddingInsets }
|
||||
set { paddingInsets = newValue }
|
||||
}
|
||||
|
||||
var desiredHeightBasedOnNumberOfLines: CGFloat {
|
||||
let spaceNeededForEachLine = lineHeight * CGFloat(numberOfLines)
|
||||
let spaceNeededForSpaces = skeletonLineSpacing * CGFloat(numberOfLines - 1)
|
||||
|
||||
Reference in New Issue
Block a user