TTBaseSUIProgressView

SwiftUI Core

SwiftUI progress indicator with three types: INDETERMINATE (spinning spinner), LINEAR (horizontal bar), and CIRCULAR (circular ring). Supports optional label text, tint color, and progress value (0.0–1.0). Wraps SwiftUI's native ProgressView with TTBaseUIKit theming.


🎨 Types

public enum TYPE {
    case INDETERMINATE  // Spinner (for unknown duration tasks)
    case LINEAR         // Horizontal progress bar (0.0–1.0)
    case CIRCULAR       // Circular ring progress
}
TypeAppearanceUse Case
.INDETERMINATESpinning indicatorLoading screens, API calls
.LINEARFilled barFile upload, download, multi-step
.CIRCULARCircular fillCompact progress, profile completion

🚀 Usage

// Indeterminate spinner
TTBaseSUIProgressView(type: .INDETERMINATE)

// With label
TTBaseSUIProgressView(
    type: .INDETERMINATE,
    label: "Loading..."
)

// Linear deterministic progress
@State private var uploadProgress: Double = 0.0

TTBaseSUIProgressView(
    type: .LINEAR,
    value: $uploadProgress
)

// Circular deterministic
TTBaseSUIProgressView(
    type: .CIRCULAR,
    value: .constant(0.75),
    label: "75%",
    tintColor: .systemGreen
)

// Full loading overlay pattern
struct FullScreenLoader: View {
    let message: String

    var body: some View {
        ZStack {
            Color.black.opacity(0.3).ignoresSafeArea()
            VStack(spacing: 16) {
                TTBaseSUIProgressView(type: .INDETERMINATE)
                TTBaseSUIText(text: message, type: .BODY)
                    .foregroundStyle(.white)
            }
            .padding(24)
            .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))
        }
    }
}

// File download with progress bar
VStack(spacing: 8) {
    HStack {
        TTBaseSUIText(text: "Downloading...", type: .BODY)
        Spacer()
        TTBaseSUIText(text: "\(Int(progress * 100))%", type: .BODY)
    }
    TTBaseSUIProgressView(
        type: .LINEAR,
        value: $progress,
        tintColor: .systemBlue
    )
}

📖 Initializer Parameters

ParameterTypeDefaultDescription
typeTYPE.INDETERMINATEProgress style
valueBinding<Double>?nilProgress value (0.0–1.0), nil = indeterminate
labelString?nilOptional text label below indicator
tintColorColor?theme primaryProgress fill color
Pro Tip: For API calls, wrap views in a .overlay(alignment: .center) with TTBaseSUIProgressView when isLoading is true. This avoids re-rendering the entire view hierarchy while showing the spinner.