diff --git a/Example/GradientLoadingBar.xcodeproj/project.pbxproj b/Example/GradientLoadingBar.xcodeproj/project.pbxproj index d585593..7f2f24d 100644 --- a/Example/GradientLoadingBar.xcodeproj/project.pbxproj +++ b/Example/GradientLoadingBar.xcodeproj/project.pbxproj @@ -11,7 +11,6 @@ 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 607FACD81AFB9204008FA782 /* BasicExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* BasicExampleViewController.swift */; }; 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; - 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 640E8AC0231457620008C5A6 /* GradientActivityIndicatorViewModelTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 640E8ABF231457620008C5A6 /* GradientActivityIndicatorViewModelTestCase.swift */; }; 6430C3A32338F1CA001F4A33 /* LargeNavigationBarHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6430C3A22338F1CA001F4A33 /* LargeNavigationBarHeaderView.swift */; }; @@ -62,7 +61,6 @@ 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 607FACD71AFB9204008FA782 /* BasicExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicExampleViewController.swift; sourceTree = ""; }; 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 607FACE51AFB9204008FA782 /* GradientLoadingBar_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GradientLoadingBar_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -156,7 +154,6 @@ 97464E6821372C010097183A /* NavigationBarExampleViewController.swift */, 607FACD51AFB9204008FA782 /* AppDelegate.swift */, 607FACD91AFB9204008FA782 /* Main.storyboard */, - 607FACDC1AFB9204008FA782 /* Images.xcassets */, 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, 607FACD31AFB9204008FA782 /* Supporting Files */, ); @@ -414,7 +411,6 @@ files = ( 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, - 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Example/GradientLoadingBar/AdvancedExampleViewController.swift b/Example/GradientLoadingBar/AdvancedExampleViewController.swift index 0b6d693..f3a1be5 100644 --- a/Example/GradientLoadingBar/AdvancedExampleViewController.swift +++ b/Example/GradientLoadingBar/AdvancedExampleViewController.swift @@ -10,6 +10,13 @@ import UIKit import GradientLoadingBar class AdvancedExampleViewController: UIViewController { + // MARK: - Config + + private enum Config { + /// + static let height: CGFloat = 3.5 + } + // MARK: - Outlets @IBOutlet private var programmaticallyButton: BlueBorderedButton! @@ -41,6 +48,13 @@ class AdvancedExampleViewController: UIViewController { setupCustomColorsGradientActivityIndicatorView() } + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + + programmaticallyGradientActivityIndicatorView.fadeOut() + customColorsGradientActivityIndicatorView.fadeOut() + } + @IBAction func toggleProgrammaticallyButtonTouchUpInside(_: Any) { if programmaticallyGradientActivityIndicatorView.isHidden { programmaticallyGradientActivityIndicatorView.fadeIn() @@ -70,7 +84,7 @@ class AdvancedExampleViewController: UIViewController { programmaticallyGradientActivityIndicatorView.trailingAnchor.constraint(equalTo: programmaticallyButton.trailingAnchor), programmaticallyGradientActivityIndicatorView.topAnchor.constraint(equalTo: programmaticallyButton.topAnchor), - programmaticallyGradientActivityIndicatorView.heightAnchor.constraint(equalToConstant: 3.5) + programmaticallyGradientActivityIndicatorView.heightAnchor.constraint(equalToConstant: Config.height) ]) } @@ -85,7 +99,7 @@ class AdvancedExampleViewController: UIViewController { customColorsGradientActivityIndicatorView.trailingAnchor.constraint(equalTo: customColorsButton.trailingAnchor), customColorsGradientActivityIndicatorView.bottomAnchor.constraint(equalTo: customColorsButton.bottomAnchor), - customColorsGradientActivityIndicatorView.heightAnchor.constraint(equalToConstant: 3.5) + customColorsGradientActivityIndicatorView.heightAnchor.constraint(equalToConstant: Config.height) ]) } } diff --git a/Example/GradientLoadingBar/Base.lproj/Main.storyboard b/Example/GradientLoadingBar/Base.lproj/Main.storyboard index 03660e9..6a8cae1 100644 --- a/Example/GradientLoadingBar/Base.lproj/Main.storyboard +++ b/Example/GradientLoadingBar/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -67,7 +67,7 @@ - + @@ -78,7 +78,7 @@ - + @@ -98,10 +98,10 @@ - + - + - + + + + + + + @@ -208,13 +233,16 @@ - + + + + - + @@ -225,7 +253,7 @@ - + @@ -278,9 +306,7 @@ - - @@ -310,7 +334,7 @@ - + @@ -321,7 +345,7 @@ - + @@ -391,7 +415,7 @@ - + @@ -402,7 +426,7 @@ - + @@ -439,7 +463,7 @@ - + @@ -456,10 +480,10 @@ - - - - - + + + + + diff --git a/Example/GradientLoadingBar/BasicExampleViewController.swift b/Example/GradientLoadingBar/BasicExampleViewController.swift index e2a333b..07cb873 100644 --- a/Example/GradientLoadingBar/BasicExampleViewController.swift +++ b/Example/GradientLoadingBar/BasicExampleViewController.swift @@ -12,13 +12,17 @@ import GradientLoadingBar class BasicExampleViewController: UIViewController { // MARK: - Public methods + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + + GradientLoadingBar.shared.fadeOut() + } + @IBAction func showButtonTouchUpInside(_: Any) { - let gradientLoadingBar = GradientLoadingBar.shared - gradientLoadingBar.fadeIn() + GradientLoadingBar.shared.fadeIn() } @IBAction func hideButtonTouchUpInside(_: Any) { - let gradientLoadingBar = GradientLoadingBar.shared - gradientLoadingBar.fadeOut() + GradientLoadingBar.shared.fadeOut() } } diff --git a/Example/GradientLoadingBar/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/GradientLoadingBar/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 19882d5..0000000 --- a/Example/GradientLoadingBar/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - }, - { - "idiom" : "ios-marketing", - "size" : "1024x1024", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/GradientLoadingBar/Images.xcassets/Contents.json b/Example/GradientLoadingBar/Images.xcassets/Contents.json deleted file mode 100644 index da4a164..0000000 --- a/Example/GradientLoadingBar/Images.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/Contents.json b/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/Contents.json deleted file mode 100644 index da4a164..0000000 --- a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/home.imageset/Contents.json b/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/home.imageset/Contents.json deleted file mode 100644 index d675922..0000000 --- a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/home.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "home.pdf" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/home.imageset/home.pdf b/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/home.imageset/home.pdf deleted file mode 100644 index ea0e25a..0000000 Binary files a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/home.imageset/home.pdf and /dev/null differ diff --git a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/idea.imageset/Contents.json b/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/idea.imageset/Contents.json deleted file mode 100644 index 263bb9f..0000000 --- a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/idea.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "idea.pdf" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/idea.imageset/idea.pdf b/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/idea.imageset/idea.pdf deleted file mode 100644 index 8c23797..0000000 Binary files a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/idea.imageset/idea.pdf and /dev/null differ diff --git a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/iphone_x.imageset/Contents.json b/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/iphone_x.imageset/Contents.json deleted file mode 100644 index 1b7b2d7..0000000 --- a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/iphone_x.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "iphone_x.pdf" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/iphone_x.imageset/iphone_x.pdf b/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/iphone_x.imageset/iphone_x.pdf deleted file mode 100644 index eca2a6a..0000000 Binary files a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/iphone_x.imageset/iphone_x.pdf and /dev/null differ diff --git a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/picture.imageset/Contents.json b/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/picture.imageset/Contents.json deleted file mode 100644 index 1a2d80a..0000000 --- a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/picture.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "picture.pdf" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/picture.imageset/picture.pdf b/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/picture.imageset/picture.pdf deleted file mode 100644 index 435f761..0000000 Binary files a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/picture.imageset/picture.pdf and /dev/null differ diff --git a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/rocket.imageset/Contents.json b/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/rocket.imageset/Contents.json deleted file mode 100644 index 541d052..0000000 --- a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/rocket.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "rocket.pdf" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/rocket.imageset/rocket.pdf b/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/rocket.imageset/rocket.pdf deleted file mode 100644 index 4bb9759..0000000 Binary files a/Example/GradientLoadingBar/Images.xcassets/iOS 11 Glyphen/rocket.imageset/rocket.pdf and /dev/null differ diff --git a/Example/GradientLoadingBar/InterfaceBuilderExampleViewController.swift b/Example/GradientLoadingBar/InterfaceBuilderExampleViewController.swift index b71a0d0..493f13c 100644 --- a/Example/GradientLoadingBar/InterfaceBuilderExampleViewController.swift +++ b/Example/GradientLoadingBar/InterfaceBuilderExampleViewController.swift @@ -16,6 +16,12 @@ class InterfaceBuilderExampleViewController: UIViewController { // MARK: - Public methods + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + + gradientActivityIndicatorView.fadeOut() + } + @IBAction func showButtonTouchUpInside(_: Any) { gradientActivityIndicatorView.fadeIn() } diff --git a/Example/GradientLoadingBar/NavigationBarExampleViewController.swift b/Example/GradientLoadingBar/NavigationBarExampleViewController.swift index adc2be0..a9e52d3 100644 --- a/Example/GradientLoadingBar/NavigationBarExampleViewController.swift +++ b/Example/GradientLoadingBar/NavigationBarExampleViewController.swift @@ -10,6 +10,13 @@ import UIKit import GradientLoadingBar class NavigationBarExampleViewController: UIViewController { + // MARK: - Config + + private enum Config { + /// + static let height: CGFloat = 3 + } + // MARK: - Private properties private let gradientProgressIndicatorView = GradientActivityIndicatorView() @@ -22,6 +29,12 @@ class NavigationBarExampleViewController: UIViewController { setupGradientProgressIndicatorView() } + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + + gradientProgressIndicatorView.fadeOut() + } + @IBAction func showButtonTouchUpInside(_: Any) { gradientProgressIndicatorView.fadeIn() } @@ -45,7 +58,7 @@ class NavigationBarExampleViewController: UIViewController { gradientProgressIndicatorView.trailingAnchor.constraint(equalTo: navigationBar.trailingAnchor), gradientProgressIndicatorView.bottomAnchor.constraint(equalTo: navigationBar.bottomAnchor), - gradientProgressIndicatorView.heightAnchor.constraint(equalToConstant: 3.0) + gradientProgressIndicatorView.heightAnchor.constraint(equalToConstant: Config.height) ]) } } diff --git a/Example/GradientLoadingBar/SafeAreaExampleViewController.swift b/Example/GradientLoadingBar/SafeAreaExampleViewController.swift index 7b38f45..9977fc9 100644 --- a/Example/GradientLoadingBar/SafeAreaExampleViewController.swift +++ b/Example/GradientLoadingBar/SafeAreaExampleViewController.swift @@ -12,15 +12,32 @@ import GradientLoadingBar class SafeAreaExampleViewController: UIViewController { // MARK: - Private properties - private let notchGradientLoadingBar = NotchGradientLoadingBar(height: 3) + private let gradientLoadingBar = GradientLoadingBar(isRelativeToSafeArea: false) + + private let notchGradientLoadingBar = NotchGradientLoadingBar(isRelativeToSafeArea: false) // MARK: - Public methods - @IBAction func showButtonTouchUpInside(_: Any) { + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + + gradientLoadingBar.fadeOut() + notchGradientLoadingBar.fadeOut() + } + + @IBAction func showBasicBarButtonTouchUpInside(_: Any) { + gradientLoadingBar.fadeIn() + } + + @IBAction func hideBasicBarButtonTouchUpInside(_: Any) { + gradientLoadingBar.fadeOut() + } + + @IBAction func showNotchBarButtonTouchUpInside(_: Any) { notchGradientLoadingBar.fadeIn() } - @IBAction func hideButtonTouchUpInside(_: Any) { + @IBAction func hideNotchBarButtonTouchUpInside(_: Any) { notchGradientLoadingBar.fadeOut() } }