35 lines
791 B
Swift
35 lines
791 B
Swift
//
|
|
// TextField.swift
|
|
// MacBackend
|
|
//
|
|
// Created by david-swift on 31.01.2025.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
/// A text field.
|
|
public struct TextField: SwiftUIWidget {
|
|
|
|
/// The text.
|
|
@Meta.Binding var text: String
|
|
/// The field's label.
|
|
var label: String
|
|
|
|
/// Initialize the text field.
|
|
/// - Parameters:
|
|
/// - label: The picker's label.
|
|
/// - text: The current text.
|
|
public init(_ label: String, text: Meta.Binding<String>) {
|
|
self.label = label
|
|
self._text = text
|
|
}
|
|
|
|
/// Get the SwiftUI view.
|
|
/// - Parameter properties: The widget data.
|
|
/// - Returns: The SwiftUI view.
|
|
public static func view(properties: Self) -> some SwiftUI.View {
|
|
SwiftUI.TextField(properties.label, text: properties._text.swiftUI)
|
|
}
|
|
|
|
}
|