macbackend/Sources/Core/View/TextField.swift
david-swift 27c30dfd79
Some checks failed
Deploy Docs / publish (push) Successful in 34m23s
SwiftLint / SwiftLint (push) Failing after 5s
Add support for text fields
2025-01-31 17:31:54 +01:00

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)
}
}