david-swift e989bea14e
All checks were successful
Deploy Docs / publish (push) Successful in 2m38s
Initial commit
2024-12-02 22:14:13 +01:00

40 lines
775 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)
} icon: {
properties.icon.image
}
}
}