diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index f8f61a3..07d83bd 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -37,8 +37,7 @@ 44C4248557D7E9DF46323FBC7C965EFD /* Disposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D38C5B20099D076D82117D02E0B7AED /* Disposable.swift */; }; 4B5A5EBA97A912894C10D040B5A1225D /* Pods-GradientLoadingBar_Tests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = B8B5E60915249521CF9DC7208F2D5774 /* Pods-GradientLoadingBar_Tests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 604C51928D4CFDAE15A6CAB6327B68D6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B802EDB707F8CE8EBD66EB815051159F /* Foundation.framework */; }; - 64C6B3E4231323B000076A69 /* Double+DefaultValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64C6B3E2231323B000076A69 /* Double+DefaultValues.swift */; }; - 64C6B3E62313241400076A69 /* UIColor+CustomColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64C6B3E52313241400076A69 /* UIColor+CustomColors.swift */; }; + 640E8ABC2313DD280008C5A6 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 640E8ABB2313DD280008C5A6 /* Constants.swift */; }; 681130A53798D8143A2C972C3351D165 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B802EDB707F8CE8EBD66EB815051159F /* Foundation.framework */; }; 757352462D522BDB0B228DE9880106ED /* Pods-GradientLoadingBar_Tests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E014E4CD6DE59FD4C7C3D12C2BC9474 /* Pods-GradientLoadingBar_Tests-dummy.m */; }; 7D00DA81B76090CC52ADBEC7E56F8A4B /* GradientLoadingBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24D0266A0CC59CB31FD536223C0F4096 /* GradientLoadingBarController.swift */; }; @@ -125,8 +124,7 @@ 52F13B2F6DA37C8A593426CD44738795 /* LightweightObservable-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "LightweightObservable-dummy.m"; sourceTree = ""; }; 5459A35FCB502D3A65BE88C4A1A7C819 /* GradientActivityIndicatorView+AnimateIsHidden.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "GradientActivityIndicatorView+AnimateIsHidden.swift"; sourceTree = ""; }; 59286ACC8816C332C7919AEBF42BC6EB /* GradientLoadingBar.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; path = GradientLoadingBar.podspec; sourceTree = ""; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - 64C6B3E2231323B000076A69 /* Double+DefaultValues.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Double+DefaultValues.swift"; sourceTree = ""; }; - 64C6B3E52313241400076A69 /* UIColor+CustomColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+CustomColors.swift"; sourceTree = ""; }; + 640E8ABB2313DD280008C5A6 /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; 670D1598351BCDDA2ACA6F3ECB0434BB /* SwiftFormat.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwiftFormat.xcconfig; sourceTree = ""; }; 67873E92210DD4E777C49C6E8AEDC108 /* GradientLoadingBar.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GradientLoadingBar.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7471906D53E2B2BEDC58FEDF3DC82244 /* Pods-GradientLoadingBar_Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-GradientLoadingBar_Example-dummy.m"; sourceTree = ""; }; @@ -283,14 +281,13 @@ name = Products; sourceTree = ""; }; - 64C6B3E0231323B000076A69 /* Extensions */ = { + 640E8ABA2313DD280008C5A6 /* Misc */ = { isa = PBXGroup; children = ( - 64C6B3E2231323B000076A69 /* Double+DefaultValues.swift */, - 64C6B3E52313241400076A69 /* UIColor+CustomColors.swift */, + 640E8ABB2313DD280008C5A6 /* Constants.swift */, ); - name = Extensions; - path = GradientLoadingBar/Classes/Extensions; + name = Misc; + path = GradientLoadingBar/Classes/Misc; sourceTree = ""; }; 77EF0692EA53DAF89BA695C6D440A85B /* SwiftFormat */ = { @@ -358,7 +355,7 @@ isa = PBXGroup; children = ( 24D0266A0CC59CB31FD536223C0F4096 /* GradientLoadingBarController.swift */, - 64C6B3E0231323B000076A69 /* Extensions */, + 640E8ABA2313DD280008C5A6 /* Misc */, EA094719D4752123C169CF31AF0B9A84 /* Pod */, 31751FF34DE410DBB12AE612F63E87F1 /* Support Files */, 7F4015331C28EB0FF79FE2118CA42B86 /* ViewModel */, @@ -625,13 +622,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 64C6B3E4231323B000076A69 /* Double+DefaultValues.swift in Sources */, 8BD7971BD44E1BB5E96B9BD7F1047F0F /* GradientActivityIndicatorView+AnimateIsHidden.swift in Sources */, B4876567964EBC1B95C76559240D1AAB /* GradientActivityIndicatorView.swift in Sources */, - 64C6B3E62313241400076A69 /* UIColor+CustomColors.swift in Sources */, 7F0493B920FABFACCE19457C63AD9719 /* GradientLoadingBar-dummy.m in Sources */, 7D00DA81B76090CC52ADBEC7E56F8A4B /* GradientLoadingBarController.swift in Sources */, 3F7EF08A0DB32C7543CFDDB67068D548 /* GradientLoadingBarViewModel.swift in Sources */, + 640E8ABC2313DD280008C5A6 /* Constants.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/GradientLoadingBar/Classes/Extensions/Double+DefaultValues.swift b/GradientLoadingBar/Classes/Extensions/Double+DefaultValues.swift deleted file mode 100644 index 1f42c08..0000000 --- a/GradientLoadingBar/Classes/Extensions/Double+DefaultValues.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// Double+DefaultValues.swift -// GradientLoadingBar -// -// Created by Felix Mau on 08/25/19. -// Copyright © 2019 Felix Mau. All rights reserved. -// - -import Foundation - -extension Double { - /// - public struct GradientLoadingBarDefaults { - /// - public static let fadeInDuration = 0.33 - - /// - public static let fadeOutDuration = 0.66 - - /// - public static let progressDuration = 3.33 - } -} diff --git a/GradientLoadingBar/Classes/Extensions/UIColor+CustomColors.swift b/GradientLoadingBar/Classes/Extensions/UIColor+CustomColors.swift deleted file mode 100644 index 2a56b2f..0000000 --- a/GradientLoadingBar/Classes/Extensions/UIColor+CustomColors.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// UIColor+CustomColors.swift -// GradientLoadingBar -// -// Created by Felix Mau on 09/22/18. -// Copyright © 2018 Felix Mau. All rights reserved. -// - -import UIKit - -extension UIColor { - // MARK: - Types - - /// Struct that contains all our custom colors. - struct CustomColors { - static let grey = #colorLiteral(red: 0.8980392157, green: 0.9137254902, blue: 0.9215686275, alpha: 1) - static let green = #colorLiteral(red: 0.2980392157, green: 0.8509803922, blue: 0.3921568627, alpha: 1) - static let violet = #colorLiteral(red: 0.3450980392, green: 0.337254902, blue: 0.8392156863, alpha: 1) - static let red = #colorLiteral(red: 1, green: 0.1764705882, blue: 0.3333333333, alpha: 1) - - static let blue = (malibu: #colorLiteral(red: 0.3529411765, green: 0.7843137255, blue: 0.9803921569, alpha: 1), azure: #colorLiteral(red: 0, green: 0.4784313725, blue: 1, alpha: 1), curious: #colorLiteral(red: 0.2039215686, green: 0.6666666667, blue: 0.862745098, alpha: 1)) - } - - // MARK: - Config - - /// - public struct GradientLoadingBarDefaults { - /// The default color palette for the gradient colors. - /// - /// - SeeAlso: https://codepen.io/marcobiedermann/pen/LExXWW - public static let gradientColorList = [ - UIColor.CustomColors.green, - UIColor.CustomColors.blue.malibu, - UIColor.CustomColors.blue.azure, - UIColor.CustomColors.blue.curious, - UIColor.CustomColors.violet, - UIColor.CustomColors.red - ] - } -} diff --git a/GradientLoadingBar/Classes/GradientLoadingBarController.swift b/GradientLoadingBar/Classes/GradientLoadingBarController.swift index 7054607..7133f11 100644 --- a/GradientLoadingBar/Classes/GradientLoadingBarController.swift +++ b/GradientLoadingBar/Classes/GradientLoadingBarController.swift @@ -69,7 +69,7 @@ open class GradientLoadingBarController { /// /// Returns: Instance with gradient bar public init(height: Double = 2.5, - gradientColorList: [UIColor] = UIColor.GradientLoadingBarDefaults.gradientColorList, + gradientColorList: [UIColor] = UIColor.GradientLoadingBar.gradientColorList, isRelativeToSafeArea: Bool = true) { self.height = height self.isRelativeToSafeArea = isRelativeToSafeArea diff --git a/GradientLoadingBar/Classes/Misc/Constants.swift b/GradientLoadingBar/Classes/Misc/Constants.swift new file mode 100644 index 0000000..ab429e5 --- /dev/null +++ b/GradientLoadingBar/Classes/Misc/Constants.swift @@ -0,0 +1,35 @@ +// +// Constants.swift +// GradientLoadingBar +// +// Created by Felix Mau on 08/26/19. +// Copyright © 2019 Felix Mau. All rights reserved. +// + +import Foundation + +extension UIColor { + /// Default colors for components. + public struct GradientLoadingBar { + /// The default color palette for the gradient colors. + /// + /// - SeeAlso: https://codepen.io/marcobiedermann/pen/LExXWW + public static let gradientColorList = [ + #colorLiteral(red: 0.2980392157, green: 0.8509803922, blue: 0.3921568627, alpha: 1), #colorLiteral(red: 0.3529411765, green: 0.7843137255, blue: 0.9803921569, alpha: 1), #colorLiteral(red: 0, green: 0.4784313725, blue: 1, alpha: 1), #colorLiteral(red: 0.2039215686, green: 0.6666666667, blue: 0.862745098, alpha: 1), #colorLiteral(red: 0.3450980392, green: 0.337254902, blue: 0.8392156863, alpha: 1), #colorLiteral(red: 1, green: 0.1764705882, blue: 0.3333333333, alpha: 1) + ] + } +} + +extension TimeInterval { + /// Nummeric default values. + public struct GradientLoadingBar { + /// The default duration for fading-in the loading bar. + public static let fadeInDuration = 0.33 + + /// The default duration for fading-out the loading bar. + public static let fadeOutDuration = 0.66 + + /// The default duration for the progress animation. + public static let progressDuration = 3.33 + } +} diff --git a/GradientLoadingBar/Classes/ViewModel/GradientLoadingBarViewModel.swift b/GradientLoadingBar/Classes/ViewModel/GradientLoadingBarViewModel.swift index d639514..9ca8ae4 100644 --- a/GradientLoadingBar/Classes/ViewModel/GradientLoadingBarViewModel.swift +++ b/GradientLoadingBar/Classes/ViewModel/GradientLoadingBarViewModel.swift @@ -39,10 +39,10 @@ class GradientLoadingBarViewModel { } /// - var fadeInDuration = Double.GradientLoadingBarDefaults.fadeInDuration + var fadeInDuration = TimeInterval.GradientLoadingBar.fadeInDuration /// - var fadeOutDuration = Double.GradientLoadingBarDefaults.fadeOutDuration + var fadeOutDuration = TimeInterval.GradientLoadingBar.fadeOutDuration // MARK: - Private properties diff --git a/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView.swift b/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView.swift index 0a1937e..e4ab87b 100644 --- a/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView.swift +++ b/GradientLoadingBar/Classes/Views/GradientActivityIndicatorView.swift @@ -28,10 +28,10 @@ open class GradientActivityIndicatorView: UIView { } /// Duration for the progress animation. - public var progressAnimationDuration = Double.GradientLoadingBarDefaults.progressDuration + public var progressAnimationDuration = TimeInterval.GradientLoadingBar.progressDuration /// Colors used for the gradient. - public var gradientColorList = UIColor.GradientLoadingBarDefaults.gradientColorList { + public var gradientColorList = UIColor.GradientLoadingBar.gradientColorList { didSet { gradientLayer.colors = infinteColorList.map { $0.cgColor } }