TTBaseSUIProgressView
SwiftUI CoreSwiftUI 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
}
| Type | Appearance | Use Case |
|---|---|---|
.INDETERMINATE | Spinning indicator | Loading screens, API calls |
.LINEAR | Filled bar | File upload, download, multi-step |
.CIRCULAR | Circular fill | Compact 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
| Parameter | Type | Default | Description |
|---|---|---|---|
type | TYPE | .INDETERMINATE | Progress style |
value | Binding<Double>? | nil | Progress value (0.0–1.0), nil = indeterminate |
label | String? | nil | Optional text label below indicator |
tintColor | Color? | theme primary | Progress 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.