Skip to content

Progress Views

Vatsal Manot edited this page Aug 14, 2019 · 5 revisions

ActivityIndicator

A view that shows that a task is in progress.

public struct ActivityIndicator: View {
    public init()

    /// Declares the content and behavior of this view.
    public var body: some View { get }

    public func animated(_ isAnimated: Bool) -> ActivityIndicator
}

Example usage:

ActivityIndicator()
    .animated(true)

ProgressBar

A linear view that depicts the progress of a task over time.

public struct ProgressBar: View {
    public init(_ value: CGFloat)

    /// Declares the content and behavior of this view.
    public var body: some View { get }
}

Example usage:

ProgressBar(0.5)
    .frame(height: 20)
    .foregroundColor(.blue)

CircularProgressBar

A circular view that depicts the progress of a task over time.

public struct CircularProgressBar: View {
    public init(_ value: CGFloat)

    /// Declares the content and behavior of this view.
    public var body: some View { get }
    
    /// Sets the line width of the view.
    public func lineWidth(_ lineWidth: CGFloat) -> CircularProgressBar
}

Example usage:

CircularProgressBar(0.5)
    .lineWidth(2)
    .foregroundColor(.blue)
    .frame(height: 100)