Files
GradientLoadingBar/Example/GradientLoadingBar/AdvancedExampleViewController.swift
T
2018-09-08 18:42:15 +02:00

60 lines
2.2 KiB
Swift

//
// AdvancedExampleViewController.swift
// GradientLoadingBar_Example
//
// Created by Felix Mau on 29.08.18.
// Copyright © 2018 CocoaPods. All rights reserved.
//
import UIKit
import GradientLoadingBar
class AdvancedExampleViewController: UIViewController {
// MARK: - Outlets
@IBOutlet var customSuperviewButton: BlueBorderedButton!
@IBOutlet var customColorsButton: BlueBorderedButton!
// MARK: - Private properties
private var buttonGradientLoadingBar: GradientLoadingBar?
private var customColorsGradientLoadingBar: GradientLoadingBar?
// MARK: - Public methods
override func viewDidLoad() {
super.viewDidLoad()
buttonGradientLoadingBar = GradientLoadingBar(height: 3.0,
onView: customSuperviewButton)
// Source: https://color.adobe.com/Pink-Flamingo-color-theme-10343714/
customColorsGradientLoadingBar = BottomGradientLoadingBar(height: 3.0,
gradientColorList: [
UIColor(hex: "#f2526e"),
UIColor(hex: "#f17a97"),
UIColor(hex: "#f3bcc8"),
UIColor(hex: "#6dddf2"),
UIColor(hex: "#c1f0f4")
],
onView: customColorsButton)
}
@IBAction func customSuperviewButtonTouchUpInside(_: Any) {
buttonGradientLoadingBar?.toggle()
}
@IBAction func customGradientColorsButtonTouchUpInside(_: Any) {
customColorsGradientLoadingBar?.toggle()
}
}
// MARK: - UIBarPositioningDelegate
// Notice: Delegate is setted-up via storyboard.
extension AdvancedExampleViewController: UINavigationBarDelegate {
func position(for _: UIBarPositioning) -> UIBarPosition {
return .topAttached
}
}