macbackend/Sources/Core/View/Label.swift
david-swift 3d2ef52cc8
Some checks failed
Deploy Docs / publish (push) Successful in 3m4s
SwiftLint / SwiftLint (push) Failing after 9s
Extract core target
2024-12-04 21:17:21 +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
}
}
}