macbackend/Sources/Core/View/Label.swift
david-swift 8391997848
Some checks failed
Deploy Docs / publish (push) Failing after 0s
SwiftLint / SwiftLint (push) Failing after 1s
Add navigation stack
2024-12-15 21:26:38 +01:00

40 lines
803 B
Swift

//
// Label.swift
// MacBackend
//
// Created by david-swift on 30.11.2024.
//
import SwiftUI
/// A label widget.
public struct Label: SwiftUIWidget {
/// The label.
var label: String
/// The icon.
var icon: Icon
/// Initialize the label.
/// - Parameters:
/// - label: The text.
/// - icon: The icon.
public init(_ label: String, icon: Icon) {
self.label = label
self.icon = icon
}
/// Get the SwiftUI view.
/// - Parameter properties: The widget data.
/// - Returns: The SwiftUI view.
public static func view(properties: Self) -> some SwiftUI.View {
SwiftUI.Label {
SwiftUI.Text(properties.label)
SwiftUI.Spacer()
} icon: {
properties.icon.image
}
}
}