Skip to content

Commit 11241ba

Browse files
committed
⬆️ :: Update dev-dependencies
1 parent 5c8a345 commit 11241ba

File tree

11 files changed

+145
-38
lines changed

11 files changed

+145
-38
lines changed

Example/GradientLoadingBar/BasicExampleViewController.swift

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,73 @@ class BasicExampleViewController: UIViewController {
2626
GradientLoadingBar.shared.fadeOut()
2727
}
2828
}
29+
30+
class ProgressGradientProgressBar: GradientLoadingBar {
31+
// MARK: - Public properties
32+
33+
/// Updates the percentage width of the `gradientActivityIndicatorView` where zero means zero width and one means full width of the current superview.
34+
var progress: CGFloat = 1 {
35+
didSet {
36+
guard let widthConstraint = widthConstraint else { return }
37+
38+
self.widthConstraint = widthConstraint.setMultiplier(multiplier: progress)
39+
gradientActivityIndicatorView.layoutIfNeeded()
40+
}
41+
}
42+
43+
// MARK: - Private properties
44+
45+
private var widthConstraint: NSLayoutConstraint?
46+
47+
// MARK: - Public methods
48+
49+
override func setupConstraints(superview: UIView) {
50+
let superViewTopAnchor: NSLayoutYAxisAnchor
51+
if #available(iOS 11.0, *), isRelativeToSafeArea {
52+
superViewTopAnchor = superview.safeAreaLayoutGuide.topAnchor
53+
} else {
54+
superViewTopAnchor = superview.topAnchor
55+
}
56+
57+
let widthConstraint = gradientActivityIndicatorView.widthAnchor.constraint(equalTo: superview.widthAnchor, multiplier: progress)
58+
self.widthConstraint = widthConstraint
59+
60+
NSLayoutConstraint.activate([
61+
gradientActivityIndicatorView.topAnchor.constraint(equalTo: superViewTopAnchor),
62+
gradientActivityIndicatorView.heightAnchor.constraint(equalToConstant: height),
63+
64+
gradientActivityIndicatorView.leadingAnchor.constraint(equalTo: superview.leadingAnchor),
65+
widthConstraint
66+
])
67+
}
68+
}
69+
70+
// MARK: - Helpers
71+
72+
private extension NSLayoutConstraint {
73+
/// Changes the multiplier constraint.
74+
///
75+
/// - Parameter multiplier: The new multiplier.
76+
///
77+
/// - Returns: NSLayoutConstraint with new multiplier.
78+
///
79+
/// - Note: Based on <https://stackoverflow.com/a/33003217>
80+
func setMultiplier(multiplier: CGFloat) -> NSLayoutConstraint {
81+
NSLayoutConstraint.deactivate([self])
82+
83+
let newConstraint = NSLayoutConstraint(item: firstItem as Any,
84+
attribute: firstAttribute,
85+
relatedBy: relation,
86+
toItem: secondItem,
87+
attribute: secondAttribute,
88+
multiplier: multiplier,
89+
constant: constant)
90+
91+
newConstraint.priority = priority
92+
newConstraint.shouldBeArchived = shouldBeArchived
93+
newConstraint.identifier = identifier
94+
95+
NSLayoutConstraint.activate([newConstraint])
96+
return newConstraint
97+
}
98+
}

Example/Podfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ PODS:
22
- GradientLoadingBar (2.1.0):
33
- LightweightObservable (~> 2.1)
44
- LightweightObservable (2.1.1)
5-
- SnapshotTesting (1.8.1)
6-
- SwiftFormat/CLI (0.45.6)
7-
- SwiftLint (0.40.0)
5+
- SnapshotTesting (1.8.2)
6+
- SwiftFormat/CLI (0.47.0)
7+
- SwiftLint (0.40.3)
88

99
DEPENDENCIES:
1010
- GradientLoadingBar (from `../`)
@@ -26,9 +26,9 @@ EXTERNAL SOURCES:
2626
SPEC CHECKSUMS:
2727
GradientLoadingBar: 9992888de03a77c1e9364c087aefa1d9c3860ef7
2828
LightweightObservable: 52abe2a01c8273921b1f66cd66526eb3328ca35a
29-
SnapshotTesting: 0bf562bd74d3e9d053cd8f1123bd7b8913304df4
30-
SwiftFormat: f1612638c8097ceed03d0149f5f5ab67174ee5dd
31-
SwiftLint: 4154893c73a4c52d6240195507eb7a3e3c64087e
29+
SnapshotTesting: 38947050d13960d57a4a9c166fcf51bca7d56970
30+
SwiftFormat: cb9bd6f3aa76ad9b24043f1f89305ea3449c17b8
31+
SwiftLint: dfd554ff0dff17288ee574814ccdd5cea85d76f7
3232

3333
PODFILE CHECKSUM: b55c1a12e9b2403a48a53c11f3f8659e36a20449
3434

Example/Pods/Manifest.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/SnapshotTesting/README.md

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/SnapshotTesting/Sources/SnapshotTesting/AssertInlineSnapshot.swift

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/SnapshotTesting/Sources/SnapshotTesting/AssertSnapshot.swift

Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/SnapshotTesting/Sources/SnapshotTesting/Common/View.swift

Lines changed: 22 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
362 KB
Binary file not shown.

Example/Pods/SwiftFormat/README.md

Lines changed: 24 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/SwiftLint/swiftlint

-33.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)