mirror of
https://github.com/fxm90/GradientLoadingBar.git
synced 2026-06-16 12:24:31 +00:00
♻️ :: Remove trailing .0 where it's not needed
This commit is contained in:
@@ -30,8 +30,8 @@ final class BlueBorderedButton: UIButton {
|
||||
backgroundColor = .clear
|
||||
tintColor = UIColor.CustomColors.blue
|
||||
|
||||
layer.cornerRadius = 4.0
|
||||
layer.cornerRadius = 4
|
||||
layer.borderColor = UIColor.CustomColors.blue.cgColor
|
||||
layer.borderWidth = 1.0
|
||||
layer.borderWidth = 1
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ class CustomColorSnapshotTestCase: XCTestCase {
|
||||
// MARK: - Config
|
||||
|
||||
/// The frame we use for rendering the `GradientLoadingBar`. This will also be the image size for our snapshot.
|
||||
private static let frame = CGRect(x: 0.0, y: 0.0, width: 375.0, height: 4.0)
|
||||
private static let frame = CGRect(origin: .zero, size: CGSize(width: 375, height: 4))
|
||||
|
||||
/// The custom colors we use on this test-case.
|
||||
/// Source: https://color.adobe.com/Pink-Flamingo-color-theme-10343714/
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ class DefaultColorSnapshotTestCase: XCTestCase {
|
||||
// MARK: - Config
|
||||
|
||||
/// The frame we use for rendering the `GradientLoadingBar`. This will also be the image size for our snapshot.
|
||||
private static let frame = CGRect(x: 0.0, y: 0.0, width: 375.0, height: 4.0)
|
||||
private static let frame = CGRect(origin: .zero, size: CGSize(width: 375, height: 4))
|
||||
|
||||
// MARK: - Test cases
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class GradientActivityIndicatorViewAnimateIsHiddenTestCase: XCTestCase {
|
||||
let expectation = self.expectation(description: "Expect completion handler to be called.")
|
||||
|
||||
// Hide view to validate fade-in.
|
||||
gradientActivityIndicatorView.alpha = 0.0
|
||||
gradientActivityIndicatorView.alpha = 0
|
||||
gradientActivityIndicatorView.isHidden = true
|
||||
|
||||
// When
|
||||
@@ -67,7 +67,7 @@ class GradientActivityIndicatorViewAnimateIsHiddenTestCase: XCTestCase {
|
||||
let expectation = self.expectation(description: "Expect completion handler to be called.")
|
||||
|
||||
// Hide view to validate fade-in.
|
||||
gradientActivityIndicatorView.alpha = 0.0
|
||||
gradientActivityIndicatorView.alpha = 0
|
||||
gradientActivityIndicatorView.isHidden = true
|
||||
|
||||
// When
|
||||
@@ -99,7 +99,7 @@ class GradientActivityIndicatorViewAnimateIsHiddenTestCase: XCTestCase {
|
||||
wait(for: [expectation], timeout: 1)
|
||||
|
||||
XCTAssertTrue(gradientActivityIndicatorView.isHidden)
|
||||
XCTAssertEqual(gradientActivityIndicatorView.alpha, 0.0, accuracy: CGFloat.ulpOfOne)
|
||||
XCTAssertEqual(gradientActivityIndicatorView.alpha, 0, accuracy: CGFloat.ulpOfOne)
|
||||
}
|
||||
|
||||
func testAnimateIsHiddenWithInterruptionShouldNotHideViewAndCallCompletionHandler() {
|
||||
@@ -128,7 +128,7 @@ class GradientActivityIndicatorViewAnimateIsHiddenTestCase: XCTestCase {
|
||||
let expectation = self.expectation(description: "Expect completion handler to be called.")
|
||||
|
||||
// Hide view to validate fade-in.
|
||||
gradientActivityIndicatorView.alpha = 0.0
|
||||
gradientActivityIndicatorView.alpha = 0
|
||||
gradientActivityIndicatorView.isHidden = true
|
||||
|
||||
// When
|
||||
@@ -149,7 +149,7 @@ class GradientActivityIndicatorViewAnimateIsHiddenTestCase: XCTestCase {
|
||||
let expectation = self.expectation(description: "Expect completion handler to be called.")
|
||||
|
||||
// Hide view to validate fade-in.
|
||||
gradientActivityIndicatorView.alpha = 0.0
|
||||
gradientActivityIndicatorView.alpha = 0
|
||||
gradientActivityIndicatorView.isHidden = true
|
||||
|
||||
// When
|
||||
@@ -183,7 +183,7 @@ class GradientActivityIndicatorViewAnimateIsHiddenTestCase: XCTestCase {
|
||||
wait(for: [expectation], timeout: 1)
|
||||
|
||||
XCTAssertTrue(gradientActivityIndicatorView.isHidden)
|
||||
XCTAssertEqual(gradientActivityIndicatorView.alpha, 0.0, accuracy: CGFloat.ulpOfOne)
|
||||
XCTAssertEqual(gradientActivityIndicatorView.alpha, 0, accuracy: CGFloat.ulpOfOne)
|
||||
}
|
||||
|
||||
func testFadeOutWithInterruptionShouldNotHideViewAndCallCompletionHandler() {
|
||||
|
||||
@@ -158,7 +158,7 @@ private extension ColorLocationMatrix {
|
||||
// we need to position them as `[ 0.0, 0.33, 0.66, 0.99]`.
|
||||
let increaseBy = 1.0 / Double(gradientColorsQuantity - 1)
|
||||
let range = 0 ..< gradientColorsQuantity
|
||||
let gradientLocations = range.reduce(into: ColorLocationRow(repeating: 0.0, count: gradientColorsQuantity)) { gradientLocations, col in
|
||||
let gradientLocations = range.reduce(into: ColorLocationRow(repeating: 0, count: gradientColorsQuantity)) { gradientLocations, col in
|
||||
let value = Double(col) * increaseBy
|
||||
gradientLocations[col] = value as NSNumber
|
||||
}
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ public extension GradientActivityIndicatorView {
|
||||
func fadeOut(duration: TimeInterval = TimeInterval.GradientLoadingBar.fadeOutDuration, completion: ((Bool) -> Void)? = nil) {
|
||||
UIView.animate(withDuration: duration,
|
||||
animations: {
|
||||
self.alpha = 0.0
|
||||
self.alpha = 0
|
||||
},
|
||||
completion: { isFinished in
|
||||
// Update `isHidden` flag accordingly:
|
||||
@@ -76,7 +76,7 @@ public extension GradientActivityIndicatorView {
|
||||
|
||||
UIView.animate(withDuration: duration,
|
||||
animations: {
|
||||
self.alpha = 1.0
|
||||
self.alpha = 1
|
||||
},
|
||||
completion: completion)
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ open class GradientActivityIndicatorView: UIView {
|
||||
|
||||
private func commonInit() {
|
||||
gradientLayer?.startPoint = .zero
|
||||
gradientLayer?.endPoint = CGPoint(x: 1.0, y: 0.0)
|
||||
gradientLayer?.endPoint = CGPoint(x: 1, y: 0)
|
||||
|
||||
bindViewModelToView()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user