diff --git a/Example/GradientLoadingBar/Views/BlueBorderedButton.swift b/Example/GradientLoadingBar/Views/BlueBorderedButton.swift index 4f86452..5ffa5a8 100644 --- a/Example/GradientLoadingBar/Views/BlueBorderedButton.swift +++ b/Example/GradientLoadingBar/Views/BlueBorderedButton.swift @@ -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 } } diff --git a/Example/SnapshotTests/GradientActivityIndicatorView/CustomColorSnapshotTestCase.swift b/Example/SnapshotTests/GradientActivityIndicatorView/CustomColorSnapshotTestCase.swift index 6b43f24..659ce95 100644 --- a/Example/SnapshotTests/GradientActivityIndicatorView/CustomColorSnapshotTestCase.swift +++ b/Example/SnapshotTests/GradientActivityIndicatorView/CustomColorSnapshotTestCase.swift @@ -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/ diff --git a/Example/SnapshotTests/GradientActivityIndicatorView/DefaultColorSnapshotTestCase.swift b/Example/SnapshotTests/GradientActivityIndicatorView/DefaultColorSnapshotTestCase.swift index 987ac8e..124f7f3 100644 --- a/Example/SnapshotTests/GradientActivityIndicatorView/DefaultColorSnapshotTestCase.swift +++ b/Example/SnapshotTests/GradientActivityIndicatorView/DefaultColorSnapshotTestCase.swift @@ -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 diff --git a/Example/Tests/Views/GradientActivityIndicatorView+AnimateIsHiddenTestCase.swift b/Example/Tests/Views/GradientActivityIndicatorView+AnimateIsHiddenTestCase.swift index 1dda9dc..4742a14 100644 --- a/Example/Tests/Views/GradientActivityIndicatorView+AnimateIsHiddenTestCase.swift +++ b/Example/Tests/Views/GradientActivityIndicatorView+AnimateIsHiddenTestCase.swift @@ -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() { diff --git a/GradientLoadingBar/Classes/ViewModel/GradientActivityIndicatorViewModel.swift b/GradientLoadingBar/Classes/ViewModel/GradientActivityIndicatorViewModel.swift index 1090ffd..74ddc1e 100644 --- a/GradientLoadingBar/Classes/ViewModel/GradientActivityIndicatorViewModel.swift +++ b/GradientLoadingBar/Classes/ViewModel/GradientActivityIndicatorViewModel.swift @@ -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 } diff --git a/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView+AnimateIsHidden.swift b/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView+AnimateIsHidden.swift index 05715c4..e321def 100644 --- a/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView+AnimateIsHidden.swift +++ b/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView+AnimateIsHidden.swift @@ -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) } diff --git a/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView.swift b/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView.swift index 96682f1..93686a0 100644 --- a/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView.swift +++ b/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView.swift @@ -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() }