40 lines
775 B
Swift
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
|
|
}
|
|
|
|
}
|
|
|
|
}
|