LoadingIndicator

open class LoadingIndicator : UIView

Displays and hides a loading indicator in the center of the view.

Subspec: View/LoadingIndicator

private lazy var loadingIndicator = LoadingIndicator(activityIndicatorViewStyle: .gray,
                                                     indicatorColor: theme.colorTheme.emphasisPrimary)

loadingIndicator.isLoading(loading: loading)

Simply adds a UIActivityIndicatorView to the center of LoadingIndicator view and allows to change the loading status.

  • Indicatior view.

    Declaration

    Swift

    private var loadingIndicator: UIActivityIndicatorView?
  • Style of the indicator.

    Declaration

    Swift

    private let activityIndicatorViewStyle: UIActivityIndicatorViewStyle
  • Custom color of the indicator.

    Declaration

    Swift

    private let indicatorColor: UIColor?
  • Default initializer of the view.

    Declaration

    Swift

    public init(activityIndicatorViewStyle: UIActivityIndicatorViewStyle = .white, indicatorColor: UIColor? = nil)

    Parameters

    activityIndicatorViewStyle

    Indicator style. Defaults to white.

    indicatorColor

    Custom color of the indicator.

  • Required initializer of the view.

    Declaration

    Swift

    public required init?(coder aDecoder: NSCoder)

    Parameters

    aDecoder

    Decoder.

  • Shows the loading indicator with the parameter provided.

    Declaration

    Swift

    public func isLoading(loading: Bool)

    Parameters

    loading

    Determines if there is a network request occuring.

  • Will add the loading indicator if its not already added.

    Declaration

    Swift

    func addLoadingIndicatorIfNeeded()
  • Shows the loading indicator with the given parameters.

    Declaration

    Swift

    func showLoadingIndicator(show: Bool, completion: ((Bool) -> Void)? = nil)

    Parameters

    show

    Flag to show if the loading indicator is visible.

    completion

    Completion block of the display animation.

  • Hides the loading indicator by stopping the animation and removing it from the superview.

    Declaration

    Swift

    func hideLoadingIndicator()
  • Adds the loading indicator and starts animating it.

    Declaration

    Swift

    private func addLoadingIndicator(indicator: UIActivityIndicatorView)

    Parameters

    indicator

    Indicator to add.