Compare commits

..

7 Commits

Author SHA1 Message Date
Sharma Elanthiraiyan 2691572392 Apply lastLineFillPercent for single line views as well. (#449)
* Apply lastLineFillPercent for single line views as well.
Fixes #430

* Update readme to include single_lastline.png

* Remove singleline_lastline.png asset added to demo last line in single line views.

* Simplify lastLineFillPercent related update in readme file.

* Fix grammar in readme.
2021-09-09 09:39:26 +02:00
Juanpe 1b9586e2d7 Bump version 1.24.4 2021-08-23 12:00:05 +00:00
Juanpe Catalán a819e69cee make skeletonPaddingInsets public again (#446) 2021-08-23 13:58:33 +02:00
Juanpe 88cd082d8e Bump version 1.24.3 2021-08-23 10:36:24 +00:00
Juanpe Catalán 1ab26cd869 Merge branch 'main' of https://github.com/Juanpe/SkeletonView 2021-08-23 12:29:16 +02:00
Juanpe Catalán 8e369c9df2 fix build fails 2021-08-23 12:29:01 +02:00
Juanpe 5fc720d3ab Bump version 1.24.2 2021-08-23 10:24:52 +00:00
8 changed files with 44 additions and 20 deletions
+1 -1
View File
@@ -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%` | ![](Assets/multiline_lastline.png)
| **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%`| ![](Assets/multiline_lastline.png)
| **Corner radius** of lines. (**NEW**) | `0...10` | `0` | ![](Assets/multiline_corner.png)
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SkeletonView"
s.version = "1.24.0"
s.version = "1.24.4"
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
View File
@@ -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 */,
@@ -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 }
}
}
@@ -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 }
@@ -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
@@ -197,7 +197,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
@@ -32,7 +32,7 @@ extension SkeletonTreeNode where Base: UIView {
extension SkeletonTreeNode where Base: UIView {
var dictionaryRepresentation: [String: Any] {
let children = children
let skeletonableChildren = children
var nodeInfo: [String: Any] = [
"type": "\(type(of: base))",
@@ -40,8 +40,8 @@ extension SkeletonTreeNode where Base: UIView {
"isSkeletonable": base.isSkeletonable
]
if !children.isEmpty {
nodeInfo["children"] = children.map { $0.dictionaryRepresentation }
if !skeletonableChildren.isEmpty {
nodeInfo["children"] = skeletonableChildren.map { $0.dictionaryRepresentation }
}
return nodeInfo
@@ -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)