Compare commits

..

16 Commits

Author SHA1 Message Date
Juanpe Catalán 0adc9683ee docs: bump and update CHANGELOG file 2020-09-10 10:59:04 +02:00
Juanpe Catalán 0521be6d6e Merge pull request #323 from Juanpe/fix/save_and_restore_button_view_state
Save and restore view state for UIButton
2020-09-09 17:35:16 +02:00
Juanpe Catalán 4167579d8a add PR in the CHANGELOG file 2020-09-09 17:31:34 +02:00
Juanpe Catalán 1bd4d3d960 feat: save and restore button view state 2020-09-09 16:49:40 +02:00
Juanpe Catalán b79219ac88 Update stale.yml 2020-09-08 14:03:07 +02:00
Juanpe Catalán 39ad7aa264 Update CHANGELOG.md 2020-09-07 13:50:13 +02:00
Juanpe Catalán 997c62b7d1 Merge pull request #319 from xpereta/fix-bottom-edge-inset
Fix to consider the top and bottom edge insets when updating the skeleton layer height
2020-09-07 13:49:40 +02:00
Xavier Pereta d4aa1743e6 Update CHANGELOG.md 2020-09-03 23:07:48 +02:00
Xavier Pereta 770be4fc06 fix: Consider the bottom and top edge insets when updating the height of the skeleton layer. 2020-09-03 23:00:42 +02:00
Juanpe Catalán cdd30bd623 Update CHANGELOG.md 2020-09-01 20:30:54 +02:00
Juanpe Catalán 0c500a943c Merge pull request #320 from Juanpe/fix_labels_single_line_appearance
Fix Single line customisation
2020-09-01 20:29:40 +02:00
Juanpe Catalán 8258b73b35 Include the PR in the CHANGELOG file 2020-09-01 20:24:42 +02:00
Juanpe Catalán 3d9e9063c5 Update Dangerfile.swift 2020-09-01 20:23:21 +02:00
Juanpe Catalán b443dcc17c use multiline height when text is a single line 2020-09-01 20:18:24 +02:00
Juanpe Catalán 13b07d9edd Update checks.yml 2020-09-01 18:50:25 +02:00
Juanpe Catalán 5a27b37e81 Merge branch 'master' into develop 2020-08-27 11:43:20 +02:00
11 changed files with 104 additions and 36 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
daysUntilStale: 20
daysUntilStale: 7
daysUntilClose: 7
onlyLabels:
- awaiting user input
+4 -2
View File
@@ -6,8 +6,10 @@ jobs:
danger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v1
- name: Execute danger
uses: danger/swift@2.0.3
uses: danger/swift@3.3.0
with:
args: --failOnErrors --no-publish-check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+30 -22
View File
@@ -3,7 +3,15 @@ All notable changes to this project will be documented in this file
### Next version
### 📦 [1.8.8](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.8)
## 📦 [1.9](https://github.com/Juanpe/SkeletonView/releases/tag/1.9)
#### 🩹 Bug fixes
* [**319**](https://github.com/Juanpe/SkeletonView/pull/319): Fix to consider the top and bottom edge insets when updating the skeleton layer height - [@xpereta](https://github.com/xpereta)
* [**320**](https://github.com/Juanpe/SkeletonView/pull/320): Fix Single line customisation - [@Juanpe](https://github.com/juanpe)
* [**323**](https://github.com/Juanpe/SkeletonView/pull/323): Save and restore view state for UIButton - [@Juanpe](https://github.com/juanpe)
## 📦 [1.8.8](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.8)
#### 🙌 New
* [**304**](https://github.com/Juanpe/SkeletonView/pull/304): French README 🇫🇷 - [@OmarJalil](https://github.com/OmarJalil)
@@ -17,7 +25,7 @@ All notable changes to this project will be documented in this file
* [**308**](https://github.com/Juanpe/SkeletonView/pull/308): Fix example backgroundColor in DarkMode - [@toshi0383](https://github.com/toshi0383)
* [**307**](https://github.com/Juanpe/SkeletonView/pull/307): Prevent incorrect skeletonLayer to be added when updating skeleton - [@wsalim1610](https://github.com/wsalim1610)
### 📦 [1.8.7](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.7)
## 📦 [1.8.7](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.7)
#### 🔬Improvements
* [**271**](https://github.com/Juanpe/SkeletonView/pull/271): Add corner radius for skeletonView as IBInspectable (CGFloat) default is 0.0 - [@paulanatoleclaudot-betclic](https://github.com/paulanatoleclaudot-betclic)
@@ -27,7 +35,7 @@ All notable changes to this project will be documented in this file
* [**274**](https://github.com/Juanpe/SkeletonView/pull/274): Fix: hiding skeleton when header and footer views of section would not hide it - [@darkside999](https://github.com/darkside999)
* [**273**](https://github.com/Juanpe/SkeletonView/pull/273): Fix: in vertical stack view with center alignment show incorrect position - [@koooootake](https://github.com/koooootake)
### 📦 [1.8.6](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.6)
## 📦 [1.8.6](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.6)
#### 🔬Improvements
* [**242**](https://github.com/Juanpe/SkeletonView/pull/242): Offscreen table view layout issue fixed - [@Cacodemon](https://github.com/Cacodemon)
@@ -41,16 +49,16 @@ All notable changes to this project will be documented in this file
* [**257**](https://github.com/Juanpe/SkeletonView/issues/257): Unit test problem when using SkeletonView
### 📦 [1.8.3](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.3)
## 📦 [1.8.3](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.3)
- Support for iOS 13 dark mode. (thanks @Wilsonator5000)
### 📦 [1.8.2](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.2)
## 📦 [1.8.2](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.2)
#### 🙌 New
- Add ability to customize line spacing per label. (thanks @gshahbazian)
### 📦 [LayoutSkeleton (1.8.1)](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.1)
## 📦 [LayoutSkeleton (1.8.1)](https://github.com/Juanpe/SkeletonView/releases/tag/1.8.1)
#### 🔬Improvements
- Fix completion call in .none transition style while hide skeletons. (thanks @aadudyrev)
@@ -66,7 +74,7 @@ All notable changes to this project will be documented in this file
- Update layout subviews when the original method is called.
- Issues: [#88, #149]
### 📦 [Transitions (1.8)](https://github.com/Juanpe/SkeletonView/releases/tag/1.8)
## 📦 [Transitions (1.8)](https://github.com/Juanpe/SkeletonView/releases/tag/1.8)
#### 🙌 New
@@ -80,7 +88,7 @@ All notable changes to this project will be documented in this file
- Solved issues.
[#175](https://github.com/Juanpe/SkeletonView/issues/175) Swift Package Manager version format
### 📦 [Layout update (1.7)](https://github.com/Juanpe/SkeletonView/releases/tag/1.7)
## 📦 [Layout update (1.7)](https://github.com/Juanpe/SkeletonView/releases/tag/1.7)
#### 🙌 New
@@ -90,7 +98,7 @@ All notable changes to this project will be documented in this file
- Allow updating skeleton layers without recreating them: `updateSkeleton`, `updateGradientSkeleton`, `updateAnimatedSkeleton`, `updateAnimatedGradientSkeleton`. (thanks @eduardbosch)
### 📦 [Debug (1.4)](https://github.com/Juanpe/SkeletonView/releases/tag/1.4)
## 📦 [Debug (1.4)](https://github.com/Juanpe/SkeletonView/releases/tag/1.4)
#### 🙌 New
@@ -104,7 +112,7 @@ All notable changes to this project will be documented in this file
#### 🩹 Bug fixes
- Solved issue [#86](https://github.com/Juanpe/SkeletonView/issues/86) (thanks @reececomo)
### 📦 [Custom defaults (1.3)](https://github.com/Juanpe/SkeletonView/releases/tag/1.3)
## 📦 [Custom defaults (1.3)](https://github.com/Juanpe/SkeletonView/releases/tag/1.3)
#### 🙌 New
@@ -114,7 +122,7 @@ All notable changes to this project will be documented in this file
#### 🩹 Bug fixes
- Solved issue [#41](https://github.com/Juanpe/SkeletonView/issues/41). Now, Skeleton works if UICollectionView cell's Nib is registered in code. (thanks @kjoneandrei)
### 📦 [Typo (1.2.3)](https://github.com/Juanpe/SkeletonView/releases/tag/1.2.3)
## 📦 [Typo (1.2.3)](https://github.com/Juanpe/SkeletonView/releases/tag/1.2.3)
#### Fixes
@@ -124,7 +132,7 @@ All notable changes to this project will be documented in this file
- Now it takes in account the `UIStackView` to calculate the `SkeletonLayer` bounds (thanks @giantramen)
### 📦 [New face (1.2.2)](https://github.com/Juanpe/SkeletonView/releases/tag/1.2.2)
## 📦 [New face (1.2.2)](https://github.com/Juanpe/SkeletonView/releases/tag/1.2.2)
#### 🙌 New
@@ -133,7 +141,7 @@ All notable changes to this project will be documented in this file
#### 🩹 Bug fixes
- Solved issue [#23](https://github.com/Juanpe/SkeletonView/issues/23). Problem with UIStackView. (thanks @giantramen)
### 📦 [State (1.2.1)](https://github.com/Juanpe/SkeletonView/releases/tag/1.2.1)
## 📦 [State (1.2.1)](https://github.com/Juanpe/SkeletonView/releases/tag/1.2.1)
#### 🙌 New
@@ -143,7 +151,7 @@ All notable changes to this project will be documented in this file
#### 🩹 Bug fixes
- Solved issue [#51](https://github.com/Juanpe/SkeletonView/issues/51). Support inspectable properties when using Carthage. (thanks @eduardbosch)
### 📦 [On TV (1.2)](https://github.com/Juanpe/SkeletonView/releases/tag/1.2)
## 📦 [On TV (1.2)](https://github.com/Juanpe/SkeletonView/releases/tag/1.2)
#### 🙌 New
- Now ```SkeletonView``` is **tvOS** compatible! 🎉. (thanks @mihai8804858)
@@ -152,12 +160,12 @@ All notable changes to this project will be documented in this file
- Solved issue [#46](https://github.com/Juanpe/SkeletonView/issues/46). It crashes the application when tap on it, didSelect called and crash.
### 📦 [Hotfix (1.1.1)](https://github.com/Juanpe/SkeletonView/releases/tag/1.1.1)
## 📦 [Hotfix (1.1.1)](https://github.com/Juanpe/SkeletonView/releases/tag/1.1.1)
#### 🩹 Bug fixes
- Now yes, solved issue [#39](https://github.com/Juanpe/SkeletonView/issues/39)
### 📦 [Needed (1.1)](https://github.com/Juanpe/SkeletonView/releases/tag/1.1)
## 📦 [Needed (1.1)](https://github.com/Juanpe/SkeletonView/releases/tag/1.1)
#### 🙌 New
- Now ```SkeletonView```supports **UICollectionViews**! 🎉. (thanks @Renatdz)
@@ -166,7 +174,7 @@ All notable changes to this project will be documented in this file
- Solved issue [#39](https://github.com/Juanpe/SkeletonView/issues/39). Gradient animation did not work when app becomes active.
### 📦 [Resizable (1.0.5)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0.5)
## 📦 [Resizable (1.0.5)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0.5)
#### 🙌 New
- Now you can use table views with resizable cells.
@@ -177,7 +185,7 @@ All notable changes to this project will be documented in this file
[#30](https://github.com/Juanpe/SkeletonView/issues/30),
[#34](https://github.com/Juanpe/SkeletonView/issues/34).
### 📦 [Filled or not (1.0.4)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0.4)
## 📦 [Filled or not (1.0.4)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0.4)
#### 🙌 New
- You can set the filling percent of the last line in multiline elements (thanks @jontelang!)
@@ -185,22 +193,22 @@ All notable changes to this project will be documented in this file
#### 🩹 Bug fixes
- Solved issue [#14](https://github.com/Juanpe/SkeletonView/issues/14). You could edit text views with skeleton active.
### 📦 [In all directions (1.0.3)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0.3)
## 📦 [In all directions (1.0.3)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0.3)
#### 🙌 New
- Create ```SkeletonAnimationBuilder```, to facilitate the creation of layer animations.
```GradientDirection``` enum.
### 📦 [Retro (1.0.2)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0.2)
## 📦 [Retro (1.0.2)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0.2)
#### 🙌 New
- Change some private keywords, to be Swift 3 compatible
### 📦 [Early bird bug (1.0.1)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0.2)
## 📦 [Early bird bug (1.0.1)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0.2)
#### 🩹 Bug fixes
- It was not removing the skeleton layer
### 📦 [Starter (1.0)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0)
## 📦 [Starter (1.0)](https://github.com/Juanpe/SkeletonView/releases/tag/1.0)
- First release
+1 -1
View File
@@ -10,7 +10,7 @@ let sourceChanges = allSourceFiles.contains { $0.hasPrefix("Sources") }
let isNotTrivial = !danger.github.pullRequest.title.contains("#trivial")
if isNotTrivial && noChangelogEntry && sourceChanges {
warn("Any changes to library code should be reflected in the Changelog.")
fail("Any changes to library code should be reflected in the Changelog.")
}
// Make it more obvious that a PR is a work in progress and shouldn't be merged yet
+19 -4
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Va7-1y-Tel">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Va7-1y-Tel">
<device id="retina5_9" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -39,7 +39,7 @@
</userDefinedRuntimeAttributes>
</textView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="avatar" translatesAutoresizingMaskIntoConstraints="NO" id="nMj-pU-5wJ">
<rect key="frame" x="141" y="20" width="93" height="93"/>
<rect key="frame" x="45" y="20" width="93" height="93"/>
<color key="backgroundColor" red="0.56078431370000004" green="0.59607843140000005" blue="0.7843137255" alpha="0.90709546230000004" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="93" id="gw9-nu-cKo"/>
@@ -49,13 +49,28 @@
<userDefinedRuntimeAttribute type="boolean" keyPath="isSkeletonable" value="YES"/>
</userDefinedRuntimeAttributes>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ifX-3x-oCb">
<rect key="frame" x="165" y="44.666666666666671" width="125" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="125" id="MuV-52-GiO"/>
<constraint firstAttribute="height" constant="44" id="vIU-os-12z"/>
</constraints>
<state key="normal" title="Button">
<color key="titleColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isSkeletonable" value="YES"/>
</userDefinedRuntimeAttributes>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="nMj-pU-5wJ" firstAttribute="centerX" secondItem="F9K-jU-100" secondAttribute="centerX" id="9X4-2r-AKx"/>
<constraint firstItem="ifX-3x-oCb" firstAttribute="centerY" secondItem="nMj-pU-5wJ" secondAttribute="centerY" id="8sl-4R-4in"/>
<constraint firstItem="e9V-mk-xH0" firstAttribute="leading" secondItem="F9K-jU-100" secondAttribute="leading" constant="45" id="HvQ-HY-zYU"/>
<constraint firstItem="e9V-mk-xH0" firstAttribute="centerX" secondItem="F9K-jU-100" secondAttribute="centerX" constant="1" id="KcB-tG-NXa"/>
<constraint firstItem="ifX-3x-oCb" firstAttribute="leading" secondItem="nMj-pU-5wJ" secondAttribute="trailing" constant="27" id="LQC-s6-w43"/>
<constraint firstAttribute="height" constant="243" id="MIj-xq-gr1"/>
<constraint firstItem="nMj-pU-5wJ" firstAttribute="leading" secondItem="F9K-jU-100" secondAttribute="leading" constant="45" id="TK6-Ws-2xY"/>
<constraint firstItem="e9V-mk-xH0" firstAttribute="top" secondItem="F9K-jU-100" secondAttribute="top" constant="142" id="Wcx-nZ-1lR"/>
<constraint firstAttribute="trailing" secondItem="e9V-mk-xH0" secondAttribute="trailing" constant="43" id="XbU-Og-rht"/>
<constraint firstItem="nMj-pU-5wJ" firstAttribute="top" secondItem="F9K-jU-100" secondAttribute="top" constant="20" id="hQL-cr-MaN"/>
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SkeletonView"
s.version = "1.8.8"
s.version = "1.9"
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.
+5 -3
View File
@@ -50,7 +50,8 @@ extension CALayer {
func addMultilinesLayers(for config: SkeletonMultilinesLayerConfig) {
let numberOfSublayers = config.lines == 1 ? 1 : calculateNumLines(for: config)
var height = config.lineHeight ?? SkeletonAppearance.default.multilineHeight
if numberOfSublayers == 1 {
if numberOfSublayers == 1 && SkeletonAppearance.default.renderSingleLineAsView {
height = bounds.height
}
@@ -79,7 +80,8 @@ extension CALayer {
let paddingInsets = config.paddingInsets
let multilineSpacing = config.multilineSpacing
var height = config.lineHeight ?? SkeletonAppearance.default.multilineHeight
if numberOfSublayers == 1 {
if numberOfSublayers == 1 && SkeletonAppearance.default.renderSingleLineAsView {
height = bounds.height
}
@@ -99,7 +101,7 @@ extension CALayer {
func updateLayerFrame(for index: Int, size: CGSize, multilineSpacing: CGFloat, paddingInsets: UIEdgeInsets) {
let spaceRequiredForEachLine = SkeletonAppearance.default.multilineHeight + multilineSpacing
frame = CGRect(x: paddingInsets.left, y: CGFloat(index) * spaceRequiredForEachLine + paddingInsets.top, width: size.width, height: size.height)
frame = CGRect(x: paddingInsets.left, y: CGFloat(index) * spaceRequiredForEachLine + paddingInsets.top, width: size.width, height: size.height - paddingInsets.bottom - paddingInsets.top)
}
private func calculateNumLines(for config: SkeletonMultilinesLayerConfig) -> Int {
@@ -12,6 +12,7 @@ enum ViewAssociatedKeys {
static var viewState = "viewState"
static var labelViewState = "labelViewState"
static var imageViewState = "imageViewState"
static var buttonViewState = "buttonViewState"
static var currentSkeletonConfig = "currentSkeletonConfig"
static var skeletonCornerRadius = "skeletonCornerRadius"
}
@@ -44,3 +44,13 @@ extension UIImageView {
}
}
}
extension UIButton {
override func prepareViewForSkeleton() {
backgroundColor = .clear
startTransition { [weak self] in
self?.setTitle(nil, for: .normal)
self?.isUserInteractionEnabled = false
}
}
}
+22 -2
View File
@@ -37,7 +37,7 @@ extension UIView: Recoverable {
}
}
extension UILabel{
extension UILabel {
var labelState: RecoverableTextViewState? {
get { return ao_get(pkey: &ViewAssociatedKeys.labelViewState) as? RecoverableTextViewState }
set { ao_setOptional(newValue, pkey: &ViewAssociatedKeys.labelViewState) }
@@ -58,7 +58,7 @@ extension UILabel{
}
}
extension UITextView{
extension UITextView {
var textState: RecoverableTextViewState? {
get { return ao_get(pkey: &ViewAssociatedKeys.labelViewState) as? RecoverableTextViewState }
set { ao_setOptional(newValue, pkey: &ViewAssociatedKeys.labelViewState) }
@@ -97,3 +97,23 @@ extension UIImageView {
}
}
}
extension UIButton {
var buttonState: RecoverableButtonViewState? {
get { return ao_get(pkey: &ViewAssociatedKeys.buttonViewState) as? RecoverableButtonViewState }
set { ao_setOptional(newValue, pkey: &ViewAssociatedKeys.buttonViewState) }
}
override func saveViewState() {
super.saveViewState()
buttonState = RecoverableButtonViewState(view: self)
}
override func recoverViewState(forced: Bool) {
super.recoverViewState(forced: forced)
startTransition { [weak self] in
self?.setTitle(self?.buttonState?.title, for: .normal)
self?.isUserInteractionEnabled = self?.buttonState?.isUserInteractionsEnabled ?? false
}
}
}
@@ -45,3 +45,13 @@ struct RecoverableImageViewState {
self.image = view.image
}
}
struct RecoverableButtonViewState {
var title: String?
var isUserInteractionsEnabled: Bool
init(view: UIButton) {
self.title = view.titleLabel?.text
self.isUserInteractionsEnabled = view.isUserInteractionEnabled
}
}