Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Example/GradientLoadingBar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
64E7F4252293E16B00BE5095 /* GradientActivityIndicatorView+AnimateIsHiddenTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64E7F4242293E16B00BE5095 /* GradientActivityIndicatorView+AnimateIsHiddenTestCase.swift */; };
77357BD34CFF2778341F80E8 /* Pods_GradientLoadingBar_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03CD5D69D7C3FBBDBF5FABBB /* Pods_GradientLoadingBar_Example.framework */; };
8020C040972E902A8CCAA9E7 /* Pods_GradientLoadingBar_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 434E3C8A6E245A38C2831E73 /* Pods_GradientLoadingBar_Tests.framework */; };
94BAEE6D25612847007BA27E /* CircleBorderedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94BAEE6C25612846007BA27E /* CircleBorderedButton.swift */; };
972CFBCC2138849A006F14C9 /* SafeAreaExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 972CFBCB2138849A006F14C9 /* SafeAreaExampleViewController.swift */; };
97464E6721372BCD0097183A /* AdvancedExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97464E6621372BCD0097183A /* AdvancedExampleViewController.swift */; };
97464E6921372C010097183A /* NavigationBarExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97464E6821372C010097183A /* NavigationBarExampleViewController.swift */; };
Expand Down Expand Up @@ -73,6 +74,7 @@
64C596EB2351D7FF00A6CC97 /* InterfaceBuilderExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceBuilderExampleViewController.swift; sourceTree = "<group>"; };
64E0F5BB2211B7D20066D00D /* GradientLoadingBarViewModelTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GradientLoadingBarViewModelTestCase.swift; sourceTree = "<group>"; };
64E7F4242293E16B00BE5095 /* GradientActivityIndicatorView+AnimateIsHiddenTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "GradientActivityIndicatorView+AnimateIsHiddenTestCase.swift"; sourceTree = "<group>"; };
94BAEE6C25612846007BA27E /* CircleBorderedButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircleBorderedButton.swift; sourceTree = "<group>"; };
972CFBCB2138849A006F14C9 /* SafeAreaExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafeAreaExampleViewController.swift; sourceTree = "<group>"; };
97464E6621372BCD0097183A /* AdvancedExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedExampleViewController.swift; sourceTree = "<group>"; };
97464E6821372C010097183A /* NavigationBarExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarExampleViewController.swift; sourceTree = "<group>"; };
Expand All @@ -81,7 +83,7 @@
97B6F5FD2143F31F008CFEA5 /* BlueBorderedButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlueBorderedButton.swift; sourceTree = "<group>"; };
A98CA9F1B0C1BD6864C14E01 /* Pods-GradientLoadingBar_SnapshotTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GradientLoadingBar_SnapshotTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-GradientLoadingBar_SnapshotTests/Pods-GradientLoadingBar_SnapshotTests.release.xcconfig"; sourceTree = "<group>"; };
ABA9B1EF5F3928BA6E31D3EA /* Pods_GradientLoadingBar_SnapshotTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GradientLoadingBar_SnapshotTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C06CA4DFA1DCB931095ABD3D /* GradientLoadingBar.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = GradientLoadingBar.podspec; path = ../GradientLoadingBar.podspec; sourceTree = "<group>"; };
C06CA4DFA1DCB931095ABD3D /* GradientLoadingBar.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = GradientLoadingBar.podspec; path = ../GradientLoadingBar.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
DC190F602496A24F0069E2B0 /* NotchGradientLoadingBarControllerTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotchGradientLoadingBarControllerTestCase.swift; sourceTree = "<group>"; };
DCE3AB11249761AB00889FFA /* Snapshotting+WindowedImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Snapshotting+WindowedImage.swift"; sourceTree = "<group>"; };
DCE3AB14249764A000889FFA /* GradientLoadingBarControllerTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GradientLoadingBarControllerTestCase.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -237,6 +239,7 @@
97B6F5FB2143F31F008CFEA5 /* Views */ = {
isa = PBXGroup;
children = (
94BAEE6C25612846007BA27E /* CircleBorderedButton.swift */,
97B6F5FC2143F31F008CFEA5 /* BlueFilledButton.swift */,
97B6F5FD2143F31F008CFEA5 /* BlueBorderedButton.swift */,
6430C3A22338F1CA001F4A33 /* LargeNavigationBarHeaderView.swift */,
Expand Down Expand Up @@ -600,6 +603,7 @@
97B6F5FE2143F31F008CFEA5 /* UIColor+CustomColors.swift in Sources */,
97B6F6002143F31F008CFEA5 /* BlueBorderedButton.swift in Sources */,
97464E6921372C010097183A /* NavigationBarExampleViewController.swift in Sources */,
94BAEE6D25612847007BA27E /* CircleBorderedButton.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
55 changes: 55 additions & 0 deletions Example/GradientLoadingBar/AdvancedExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class AdvancedExampleViewController: UIViewController {

@IBOutlet private var programmaticallyButton: BlueBorderedButton!
@IBOutlet private var customColorsButton: BlueBorderedButton!
@IBOutlet private var roundedButton: BlueBorderedButton!
@IBOutlet private var circleButton: UIButton!

// MARK: - Private properties

Expand All @@ -39,13 +41,18 @@ class AdvancedExampleViewController: UIViewController {
return gradientActivityIndicatorView
}()

private let cirlceGradientActivityIndicatorView = RoundedGradientActivityIndicatorView()
private let roundedGradientActivityIndicatorView = RoundedGradientActivityIndicatorView()

// MARK: - Public methods

override func viewDidLoad() {
super.viewDidLoad()

setupProgrammaticallyGradientActivityIndicatorView()
setupCustomColorsGradientActivityIndicatorView()
setupCircleGradientActivityIndicatorView()
setupRoundedGradientActivityIndicatorView()
}

override func viewWillDisappear(_ animated: Bool) {
Expand All @@ -71,6 +78,22 @@ class AdvancedExampleViewController: UIViewController {
}
}

@IBAction func toggleCircleButtonTouchUpInside(_: Any) {
if cirlceGradientActivityIndicatorView.isHidden {
cirlceGradientActivityIndicatorView.fadeIn()
} else {
cirlceGradientActivityIndicatorView.fadeOut()
}
}

@IBAction func toggleRoundedButtonTouchUpInside(_: Any) {
if roundedGradientActivityIndicatorView.isHidden {
roundedGradientActivityIndicatorView.fadeIn()
} else {
roundedGradientActivityIndicatorView.fadeOut()
}
}

// MARK: - Private methods

private func setupProgrammaticallyGradientActivityIndicatorView() {
Expand Down Expand Up @@ -102,4 +125,36 @@ class AdvancedExampleViewController: UIViewController {
customColorsGradientActivityIndicatorView.heightAnchor.constraint(equalToConstant: Config.height)
])
}

private func setupCircleGradientActivityIndicatorView() {
circleButton.contentEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
cirlceGradientActivityIndicatorView.fadeOut(duration: 0)

cirlceGradientActivityIndicatorView.translatesAutoresizingMaskIntoConstraints = false
circleButton.addSubview(cirlceGradientActivityIndicatorView)

NSLayoutConstraint.activate([
cirlceGradientActivityIndicatorView.leadingAnchor.constraint(equalTo: circleButton.leadingAnchor),
cirlceGradientActivityIndicatorView.trailingAnchor.constraint(equalTo: circleButton.trailingAnchor),

cirlceGradientActivityIndicatorView.topAnchor.constraint(equalTo: circleButton.topAnchor),
cirlceGradientActivityIndicatorView.bottomAnchor.constraint(equalTo: circleButton.bottomAnchor)
])
}

private func setupRoundedGradientActivityIndicatorView() {
roundedButton.layer.cornerRadius = 20
roundedGradientActivityIndicatorView.fadeOut(duration: 0)

roundedGradientActivityIndicatorView.translatesAutoresizingMaskIntoConstraints = false
roundedButton.addSubview(roundedGradientActivityIndicatorView)

NSLayoutConstraint.activate([
roundedGradientActivityIndicatorView.leadingAnchor.constraint(equalTo: roundedButton.leadingAnchor),
roundedGradientActivityIndicatorView.trailingAnchor.constraint(equalTo: roundedButton.trailingAnchor),

roundedGradientActivityIndicatorView.topAnchor.constraint(equalTo: roundedButton.topAnchor),
roundedGradientActivityIndicatorView.bottomAnchor.constraint(equalTo: roundedButton.bottomAnchor)
])
}
}
Loading