Skip to content

Class

ActivityIndicator

An instance of a ActivityIndicatorType that can be started, failed, and succeeded.
final class ActivityIndicator<A> where A : ActivityIndicatorType

Overview

Use newActivity(for:) on ActivityIndicatorType to create one.

let loadingBar = console.loadingBar(title: "Loading")
background {
    // complete the loading bar after 3 seconds
    console.wait(seconds: 3)
    loadingBar.succeed()
}
// start the loading bar and wait for it to finish
try loadingBar.start(on: ...).wait()

Topics

Instance Properties

  • var activity: A
    The generic ActivityIndicatorType powering this ActivityIndicator.

Instance Methods

  • func fail()
    Stops the ActivityIndicator, yielding a failed / error appearance.
  • func start(refreshRate: Int)
    Starts the ActivityIndicator. Usually this means beginning the associated “loading” animation.
  • func succeed()
    Stops the ActivityIndicator, yielding a success / done appearance.

Relationships

Conforms To

  • Swift.Sendable
  • Swift.SendableMetatype