Compare commits

...

22 Commits

Author SHA1 Message Date
Alexander ca7d2edcee Fix "complementaryColor" color isn't changed after updating the application theme (#496) 2022-09-05 09:26:20 +02:00
Juanpe Catalán 3688549eb8 Update Stale action 2022-08-29 08:48:23 +02:00
Juanpe Catalán f27a4f69ff Create needs-attention.yml 2022-08-29 08:40:38 +02:00
Juanpe 2ac515b97e Bump version 1.30.1 2022-08-16 08:36:34 +00:00
Tom Cheung 969f068480 Bugfix/tableview insetgrouped (#494)
* Fixed TableView skeleton cannot hide if style is insetGrouped

* Fixed show skeleton button not visible

* Update the fix base on PR comments
2022-08-16 10:35:13 +02:00
Juanpe Catalán fbc2e6f8d2 Update README.md 2022-08-11 21:00:45 +02:00
Juanpe Catalán 8be6c81729 Revert changes in the Package file 2022-08-11 20:16:10 +02:00
Juanpe Catalán 87c4706be8 Testing XCFramework 2022-08-11 20:13:19 +02:00
Juanpe b4d6dc2602 Bump version 1.30.0 2022-08-11 16:33:23 +00:00
Carlos Enumo f859d197f3 Add prepareViewForSkeleton to SkeletonCollectionViewDataSource (#505) 2022-08-11 18:32:08 +02:00
Juanpe 3a11e233c7 Bump version 1.29.4 2022-08-11 16:15:54 +00:00
dependabot[bot] ddd4fdbb1f Bump tzinfo from 1.2.5 to 1.2.10 (#507)
Bumps [tzinfo](https://github.com/tzinfo/tzinfo) from 1.2.5 to 1.2.10.
- [Release notes](https://github.com/tzinfo/tzinfo/releases)
- [Changelog](https://github.com/tzinfo/tzinfo/blob/master/CHANGES.md)
- [Commits](https://github.com/tzinfo/tzinfo/compare/v1.2.5...v1.2.10)

---
updated-dependencies:
- dependency-name: tzinfo
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-11 18:14:28 +02:00
Juanpe Catalán 00394e0b9f Add Swift Package Index badge for platforms 2022-06-01 08:35:50 +02:00
Juanpe daea88df8f Bump version 1.29.3 2022-06-01 06:32:58 +00:00
dependabot[bot] b640c1d8ee Bump cocoapods-downloader from 1.2.2 to 1.6.3 (#497)
Bumps [cocoapods-downloader](https://github.com/CocoaPods/cocoapods-downloader) from 1.2.2 to 1.6.3.
- [Release notes](https://github.com/CocoaPods/cocoapods-downloader/releases)
- [Changelog](https://github.com/CocoaPods/cocoapods-downloader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/CocoaPods/cocoapods-downloader/compare/1.2.2...1.6.3)

---
updated-dependencies:
- dependency-name: cocoapods-downloader
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-01 08:31:25 +02:00
Juanpe 2eaf72ed0e Bump version 1.29.2 2022-01-18 14:21:59 +00:00
Juanpe Catalán 9e61ff3a85 Fix crash when text is empty (#483) 2022-01-18 15:20:32 +01:00
Juanpe Catalán 204b871f17 Update CD.yml 2022-01-18 14:56:28 +01:00
Juanpe Catalán ecb41f1885 Update stale.yml 2022-01-15 10:17:58 +01:00
Juanpe dffbd8cbfd Bump version 1.29.1 2022-01-10 15:33:01 +00:00
Juanpe Catalán 458e5fc29b Fix animation when the transition is .none (#481) 2022-01-10 16:32:00 +01:00
Juanpe a6f335df01 Bump version 1.29.0 2022-01-10 10:24:35 +00:00
16 changed files with 103 additions and 42 deletions
-10
View File
@@ -1,10 +0,0 @@
daysUntilStale: 7
daysUntilClose: 7
onlyLabels:
- awaiting user input
staleLabel: given up
markComment: >
🤖 This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions 🙂
closeComment: false
+4 -3
View File
@@ -12,8 +12,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup fastlane
run: brew install fastlane
- name: Setup Environment
run: |
brew install fastlane
brew install cocoapods
- name: Publish release
id: publish_release
@@ -39,7 +41,6 @@ jobs:
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
gem install cocoapods
set -eo pipefail
pod lib lint --allow-warnings
pod trunk push --allow-warnings
+18
View File
@@ -0,0 +1,18 @@
name: Issue Needs Attention
# This workflow is triggered on issue comments.
on:
issue_comment:
types: created
jobs:
applyNeedsAttentionLabel:
name: Apply Needs Attention Label
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Apply Needs Attention Label
uses: hramos/needs-attention@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
response-required-label: 'awaiting user info'
needs-attention-label: 'needs triage'
+18
View File
@@ -0,0 +1,18 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 5 * * *'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
close-issue-message: 'Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.'
stale-issue-message: '🤖 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions 🙂'
days-before-stale: 5
days-before-close: 3
enable-statistics: true
operations-per-run: 60
only-labels: 'awaiting user input'
@@ -2,13 +2,8 @@
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
"platform" : "universal",
"reference" : "systemBlueColor"
},
"idiom" : "universal"
},
+2 -2
View File
@@ -36,7 +36,7 @@ GEM
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.2.2)
cocoapods-downloader (1.6.3)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
@@ -182,7 +182,7 @@ GEM
tty-screen (0.7.0)
tty-spinner (0.9.1)
tty-cursor (~> 0.7)
tzinfo (1.2.5)
tzinfo (1.2.10)
thread_safe (~> 0.1)
uber (0.1.0)
unf (0.1.4)
+1 -1
View File
@@ -1,4 +1,4 @@
// swift-tools-version:5.0
// swift-tools-version:5.3
import PackageDescription
+6 -1
View File
@@ -8,7 +8,7 @@
<a href="https://cocoapods.org/pods/SkeletonView"><img src="https://img.shields.io/cocoapods/v/SkeletonView.svg?style=flat"></a>
<a href="https://github.com/Carthage/Carthage/"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat"></a>
<a href="https://swift.org/package-manager/"><img src="https://img.shields.io/badge/SPM-supported-Green.svg?style=flat"></a>
<img src="https://img.shields.io/badge/platforms-iOS_tvOS-green" />
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FJuanpe%2FSkeletonView%2Fbadge%3Ftype%3Dplatforms"/>
<a href="https://badge.bow-swift.io/recipe?name=SkeletonView&description=An%20elegant%20way%20to%20show%20users%20that%20something%20is%20happening%20and%20also%20prepare%20them%20to%20which%20contents%20he%20is%20waiting&url=https://github.com/juanpe/skeletonview&owner=Juanpe&avatar=https://avatars0.githubusercontent.com/u/1409041?v=4&tag=1.20.0"><img src="https://raw.githubusercontent.com/bow-swift/bow-art/master/badges/nef-playgrounds-badge.svg" alt="SkeletonView Playground" style="height:20px"></a>
</p>
@@ -90,6 +90,10 @@ dependencies: [
]
```
> 📣 **IMPORTANT!**
>
> Since version 1.30.0, `SkeletonView` supports **XCFrameworks**, so if you want to install it as a **XCFramework**, please use [this repo](https://github.com/Juanpe/SkeletonView-XCFramework.git) instead.
## 🐒 Usage
@@ -250,6 +254,7 @@ public protocol SkeletonCollectionViewDataSource: UICollectionViewDataSource {
func collectionSkeletonView(_ skeletonView: UICollectionView, supplementaryViewIdentifierOfKind: String, at indexPath: IndexPath) -> ReusableCellIdentifier? // default: nil
func collectionSkeletonView(_ skeletonView: UICollectionView, skeletonCellForItemAt indexPath: IndexPath) -> UICollectionViewCell? // default: nil
func collectionSkeletonView(_ skeletonView: UICollectionView, prepareCellForSkeleton cell: UICollectionViewCell, at indexPath: IndexPath)
func collectionSkeletonView(_ skeletonView: UICollectionView, prepareViewForSkeleton view: UICollectionReusableView, at indexPath: IndexPath)
}
```
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SkeletonView"
s.version = "1.28.0"
s.version = "1.30.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.
@@ -15,6 +15,7 @@ public protocol SkeletonCollectionViewDataSource: UICollectionViewDataSource {
func collectionSkeletonView(_ skeletonView: UICollectionView, supplementaryViewIdentifierOfKind: String, at indexPath: IndexPath) -> ReusableCellIdentifier?
func collectionSkeletonView(_ skeletonView: UICollectionView, skeletonCellForItemAt indexPath: IndexPath) -> UICollectionViewCell?
func collectionSkeletonView(_ skeletonView: UICollectionView, prepareCellForSkeleton cell: UICollectionViewCell, at indexPath: IndexPath)
func collectionSkeletonView(_ skeletonView: UICollectionView, prepareViewForSkeleton view: UICollectionReusableView, at indexPath: IndexPath)
}
public extension SkeletonCollectionViewDataSource {
@@ -35,6 +36,8 @@ public extension SkeletonCollectionViewDataSource {
}
func collectionSkeletonView(_ skeletonView: UICollectionView, prepareCellForSkeleton cell: UICollectionViewCell, at indexPath: IndexPath) { }
func collectionSkeletonView(_ skeletonView: UICollectionView, prepareViewForSkeleton view: UICollectionReusableView, at indexPath: IndexPath) { }
}
public protocol SkeletonCollectionViewDelegate: UICollectionViewDelegate { }
@@ -103,6 +103,8 @@ extension SkeletonCollectionDataSource: UICollectionViewDataSource {
at indexPath: IndexPath) -> UICollectionReusableView {
if let viewIdentifier = originalCollectionViewDataSource?.collectionSkeletonView(collectionView, supplementaryViewIdentifierOfKind: kind, at: indexPath) {
let view = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: viewIdentifier, for: indexPath)
originalCollectionViewDataSource?.collectionSkeletonView(collectionView, prepareViewForSkeleton: view, at: indexPath)
skeletonizeViewIfContainerSkeletonIsActive(container: collectionView, view: view)
return view
}
@@ -28,12 +28,12 @@ struct SkeletonLayer {
self.maskLayer.bounds = holder.definedMaxBounds
self.maskLayer.cornerRadius = CGFloat(holder.skeletonCornerRadius)
addTextLinesIfNeeded()
self.maskLayer.tint(withColors: colors)
self.maskLayer.tint(withColors: colors, traitCollection: holder.traitCollection)
}
func update(usingColors colors: [UIColor]) {
layoutIfNeeded()
maskLayer.tint(withColors: colors)
maskLayer.tint(withColors: colors, traitCollection: holder?.traitCollection)
}
func layoutIfNeeded() {
@@ -106,9 +106,11 @@ extension UILabel: SkeletonTextNode {
}
var fontLineHeight: CGFloat? {
if let attributes = attributedText?.attributes(at: 0, effectiveRange: nil),
let fontAttribute = attributes.first(where: { $0.key == .font }) {
return fontAttribute.value as? CGFloat ?? font.lineHeight
if let attributedText = attributedText,
attributedText.length > 0 {
let attributes = attributedText.attributes(at: 0, effectiveRange: nil)
let fontAttribute = attributes.first(where: { $0.key == .font })
return fontAttribute?.value as? CGFloat ?? font.lineHeight
} else {
return font.lineHeight
}
@@ -179,9 +181,11 @@ extension UITextView: SkeletonTextNode {
}
var fontLineHeight: CGFloat? {
if let attributes = attributedText?.attributes(at: 0, effectiveRange: nil),
let fontAttribute = attributes.first(where: { $0.key == .font }) {
return fontAttribute.value as? CGFloat ?? font?.lineHeight
if let attributedText = attributedText,
attributedText.length > 0 {
let attributes = attributedText.attributes(at: 0, effectiveRange: nil)
let fontAttribute = attributes.first(where: { $0.key == .font })
return fontAttribute?.value as? CGFloat ?? font?.lineHeight
} else {
return font?.lineHeight
}
@@ -21,7 +21,18 @@ extension UITableView {
// Some developer trying to call `view.showAnimatedSkeleton()`
// when the request or data is loading which sometimes happens before the ViewDidAppear
guard window != nil else { return [] }
return subviews
var result = [UIView]()
for subview in subviews {
if String(describing: type(of: subview)) == "UITableViewWrapperView" {
result.append(contentsOf: subview.subviews)
} else {
result.append(subview)
}
}
return result
}
}
@@ -15,11 +15,15 @@ import UIKit
extension CAGradientLayer {
override func tint(withColors colors: [UIColor]) {
override func tint(withColors colors: [UIColor], traitCollection: UITraitCollection?) {
skeletonSublayers.recursiveSearch(leafBlock: {
self.colors = colors.map { $0.cgColor }
if #available(iOS 13.0, tvOS 13, *), let traitCollection = traitCollection {
self.colors = colors.map { $0.resolvedColor(with: traitCollection).cgColor }
} else {
self.colors = colors.map { $0.cgColor }
}
}) {
$0.tint(withColors: colors)
$0.tint(withColors: colors, traitCollection: traitCollection)
}
}
@@ -35,11 +39,15 @@ extension CALayer {
return sublayers?.filter { $0.name == Constants.skeletonSubLayersName } ?? [CALayer]()
}
@objc func tint(withColors colors: [UIColor]) {
@objc func tint(withColors colors: [UIColor], traitCollection: UITraitCollection?) {
skeletonSublayers.recursiveSearch(leafBlock: {
backgroundColor = colors.first?.cgColor
if #available(iOS 13.0, tvOS 13, *), let traitCollection = traitCollection {
backgroundColor = colors.first?.resolvedColor(with: traitCollection).cgColor
} else {
backgroundColor = colors.first?.cgColor
}
}) {
$0.tint(withColors: colors)
$0.tint(withColors: colors, traitCollection: traitCollection)
}
}
@@ -78,7 +86,7 @@ extension CALayer {
insertSublayer(sublayer.contentLayer, at: index)
switch transition {
case .none:
completion?()
DispatchQueue.main.async { completion?() }
case .crossDissolve(let duration):
sublayer.contentLayer.setOpacity(from: 0, to: 1, duration: duration, completion: completion)
}
@@ -43,7 +43,13 @@ public extension UIColor {
}
var complementaryColor: UIColor {
isLight ? darker : lighter
if #available(iOS 13, tvOS 13, *) {
return UIColor { _ in
self.isLight ? self.darker : self.lighter
}
} else {
return isLight ? darker : lighter
}
}
var lighter: UIColor {