InfoView

public struct InfoView
extension InfoView: View
extension InfoView: _ViewEmptyChecking

InfoView is a multifunctional view for displaying Information or Splash screen. The UI elements can be displayed or hidden depending on functionality. The text properties must be set before displaying the view.

Initialization Parameters

  • Required:
    • title: The primary heading text (AttributedString or ViewBuilder)
  • Optional:
    • descriptionText: Supplemental information text
    • action: Primary action control
    • secondaryAction: Secondary action control
    • loadingIndicator: Loading state visualization

Usage

AttributedString Shortcut (Quick Setup)

InfoView(
    title: AttributedString("Title"),
    descriptionText: AttributedString("Description Text"),
    action: FioriButton(title: "Update Now") {
        startUpdate()
    },
    secondaryAction: FioriButton(title: "Remind Later") {
        scheduleReminder()
    }
)

ViewBuilder Approach (Fully Customizable)

// Custom loading indicator with red circular style
let loadingIndicator = LoadingIndicator(
    title: { Text("") },
    progress: {
        ProgressView()
            .progressViewStyle(CircularProgressViewStyle(tint: .red))
    },
    isPresented: .constant(true)
)

InfoView(
    title: {
        HStack(spacing: 8) {
            Image(systemName: "exclamationmark.triangle.fill")
                .foregroundColor(.yellow)
            Text("Title")
                .font(.headline)
        }
    },
    descriptionText: {
        Text(AttributedString(self.model.descriptionText ?? "")) // Dynamic title from model
            .foregroundColor(.blue)  // Custom text color
    },
    action: {
        Toggle("Trust Device", isOn: $trustDevice)
            .toggleStyle(.switch)
    },
    secondaryAction: {
        Button("Start Tutorial") {
            print("InfoView secondary button clicked")
        }
    },
    loadingIndicator: { loadingIndicator }
)